BoundSetter

public class BoundSetter<S, A>

A BoundSetter is a Setter that is already bound to a concrete source.

  • Initializes a BoundSetter.

    Declaration

    Swift

    public init(value: S, setter: Setter<S, A>)

    Parameters

    value

    Bound source.

    setter

    Setter.

  • Modifies the source of the bound setter.

    Declaration

    Swift

    public func modify(_ f: @escaping (A) -> A) -> S

    Parameters

    f

    Function modifying the focus.

    Return Value

    Modified source.

  • Sets a new value for the focus.

    Declaration

    Swift

    public func set(_ a: A) -> S

    Parameters

    a

    New focus.

    Return Value

    Modified source.

  • Composes with a Setter.

    Declaration

    Swift

    public func compose<T>(_ other: Setter<A, T>) -> BoundSetter<S, T>

    Parameters

    other

    Value to compose with.

    Return Value

    A BoundSetter with the same bound source and a Setter resulting from the sequential application of the two optics.

  • Composes with an AffineTraversal.

    Declaration

    Swift

    public func compose<T>(_ other: AffineTraversal<A, T>) -> BoundSetter<S, T>

    Parameters

    other

    Value to compose with.

    Return Value

    A BoundSetter with the same bound source and a Setter resulting from the sequential application of the two optics.

  • Composes with a Prism.

    Declaration

    Swift

    public func compose<T>(_ other: Prism<A, T>) -> BoundSetter<S, T>

    Parameters

    other

    Value to compose with.

    Return Value

    A BoundSetter with the same bound source and a Setter resulting from the sequential application of the two optics.

  • Composes with a Lens.

    Declaration

    Swift

    public func compose<T>(_ other: Lens<A, T>) -> BoundSetter<S, T>

    Parameters

    other

    Value to compose with.

    Return Value

    A BoundSetter with the same bound source and a Setter resulting from the sequential application of the two optics.

  • Composes with an Iso.

    Declaration

    Swift

    public func compose<T>(_ other: Iso<A, T>) -> BoundSetter<S, T>

    Parameters

    other

    Value to compose with.

    Return Value

    A BoundSetter with the same bound source and a Setter resulting from the sequential application of the two optics.