Connectable

@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
public protocol Connectable

Makes a view connectable to the application state.

  • Undocumented

    Declaration

    Swift

    associatedtype Superstate
  • Undocumented

    Declaration

    Swift

    associatedtype State
  • updateWhen(action:) Default implementation

    Causes the view to be updated based on a dispatched action.

    Default Implementation

    Default implementation disables updates by action.

    Declaration

    Swift

    func updateWhen(action: Action) -> Bool

    Parameters

    action

    The dispatched action

    Return Value

    True if the view should update.

  • Map a superstate to the state needed by the view using the provided parameter.

    The method can return nil until the state becomes available. While it is nil, the view will not be rendered.

    Declaration

    Swift

    func map(state: Superstate) -> State?

    Parameters

    state

    The superstate provided to the view from a superview.

    Return Value

    The state if possible.

  • connect() Extension method

    Connect the view to the application state

    Declaration

    Swift

    public func connect() -> some View

    Return Value

    The connected view.