AutoFold

public protocol AutoFold : AutoLens

Protocol for automatic Fold derivation

  • fold(for:) Extension method

    Provides a Fold focused on the items of the field given by a key path.

    Declaration

    Swift

    static func fold<T>(for path: WritableKeyPath<Self, Array<T>>) -> Fold<Self, T>

    Parameters

    path

    Key path to a field containing an array of items.

    Return Value

    A Fold optic focused on the items of the specified field.

  • fold(for:) Extension method

    Provides a Fold focused on the items of the field given by a key path.

    Declaration

    Swift

    static func fold<T>(for path: WritableKeyPath<Self, ArrayK<T>>) -> Fold<Self, T>

    Parameters

    path

    Key path to a field containing an ArrayK of items.

    Return Value

    A Fold optic focused on the items of the specified field.

  • fold(for:) Extension method

    Provides a Fold focused on the items of a Foldable field given by a key path.

    Declaration

    Swift

    static func fold<T, F>(for path: WritableKeyPath<Self, Kind<F, T>>) -> Fold<Self, T> where F : Foldable

    Parameters

    path

    Key path to a field of a type with an instance of Foldable.

    Return Value

    A Fold optic focused on the item wrapped in a Foldable.