Connectable

public protocol Connectable

Makes a view “connectable” to the application state.

This should not be used directly. Instead, use ConnectableView. This protocol isn’t combined into ConnectableView due to a possible bug in Swift that throws an invalid assocated type if Props isn’t explicitly typealiased.

  • Undocumented

    Declaration

    Swift

    associatedtype Superstate : Equatable
  • Undocumented

    Declaration

    Swift

    associatedtype Props : Equatable
  • 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(state:) Default implementation

    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.

    Default Implementation

    Default implementation. Returns nil.

    Declaration

    Swift

    func map(state: Superstate) -> Props?

    Parameters

    state

    The superstate provided to the view from a superview.

    Return Value

    The state if possible.

  • map(state:binder:) Default implementation

    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.

    Default Implementation

    Default implementation. Calls the other map function.

    Declaration

    Swift

    func map(state: Superstate, binder: ActionBinder) -> Props?

    Parameters

    state

    The superstate provided to the view from a superview.

    binder

    Helper that creates Binding types beteen the state and a dispatcable action

    Return Value

    The state if possible.