AutoPrism

public protocol AutoPrism : AutoOptics

Protocol for automatic derivation of Prism optics.

  • prism(for:) Extension method

    Generates a prism for an enum case with no associated values.

    Declaration

    Swift

    static func prism(for case: Self) -> Prism<Self, ()>

    Parameters

    case

    Case where the Prism must focus.

    Return Value

    A Prism focusing on the provided case.

  • prism(for:) Extension method

    Generates a prism for an enum case with associated values.

    Declaration

    Swift

    static func prism<A>(for constructor: @escaping (A) -> Self) -> Prism<Self, A>

    Parameters

    constructor

    Constructor for the case with associated values.

    Return Value

    A Prism focusing on the provided case.