AutoSetter

public protocol AutoSetter : AutoOptics

Protocol for automatic derivation of Setter

  • setter(for:) Extension method

    Generates a Setter for the provided field.

    Declaration

    Swift

    static func setter<T>(for path: WritableKeyPath<Self, T>) -> Setter<Self, T>

    Parameters

    path

    Key path for the field.

    Return Value

    A Setter that focuses on the provided field.

  • Generates a BoundSetter for the provided field on a specific value.

    Declaration

    Swift

    static func boundSetter<T>(for path: WritableKeyPath<Self, T>, onValue value: Self) -> BoundSetter<Self, T>

    Parameters

    path

    Key path for the field.

    value

    Value to bind the setter to.

    Return Value

    A BoundSetter that focuses on the provided field on the specific value.

  • boundSetter(for:) Extension method

    Generates a BoundSetter for the provided field on this value.

    Declaration

    Swift

    func boundSetter<T>(for path: WritableKeyPath<Self, T>) -> BoundSetter<Self, T>

    Parameters

    path

    Key path for the field.

    Return Value

    A BoundSetter that focuses on the provided field.