AutoOptional

public protocol AutoOptional : AutoOptics

Protocol for automatic derivation of Optional optics.

  • optional(for:) Extension method

    Generates an Optional optic that focuses on a nilable field.

    Declaration

    Swift

    static func optional<T>(for path: WritableKeyPath<Self, T?>) -> Optional<Self, T>

    Parameters

    path

    Key path to a nilable field.

    Return Value

    An Optional optic focusing on the provided field.

  • optional(for:) Extension method

    Generates an Optional optic that focuses on an Option field.

    Declaration

    Swift

    static func optional<T>(for path: WritableKeyPath<Self, Option<T>>) -> Optional<Self, T>

    Parameters

    path

    Key path to an Option field.

    Return Value

    An Optional optic focusing on the provided field.