ContextAcceptingView

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
public protocol ContextAcceptingView

The protocol for a View to make it compatible with ContextSettingTask.

Due to some current swift limitations protocol ContextAccepting can not be used directly.

Associated types

  • Type of Context object that View can be accept

    Declaration

    Swift

    associatedtype Context

Methods to implement

  • checkCompatibility(with:) Default implementation

    If View does not support all the permutations that context instance may have - setup the check here.

    Throws

    throws Error if Context instance is not supported.

    Default Implementation

    Default implementation does nothing.

    Declaration

    Swift

    static func checkCompatibility(with context: Context) throws

    Parameters

    context

    Context instance.

  • ContextSettingTask will call this method to provide the Context instance to the View that has just been build or found.

    Throws

    throws Error if Context instance is not supported. Router will stop building the rest of the stack in this case.

    Declaration

    Swift

    mutating func setup(with context: Context) throws

    Parameters

    context

    Context instance.