Presentable

public protocol Presentable

Presentable represents all objects that can be presented (i.e. shown) to the user.

Therefore, it is useful for view controllers, coordinators and views. Presentable is often used for transitions to allow for view controllers and coordinators to be transitioned to.

  • The viewController of the Presentable.

    In the case of a UIViewController, it returns itself. A coordinator returns its rootViewController.

    Declaration

    Swift

    var viewController: UIViewController! { get }
  • router(for:) Default implementation

    This method can be used to retrieve whether the presentable can trigger a specific route and potentially returns a router to trigger the route on.

    Deep linking makes use of this method to trigger the specified routes.

    Default Implementation

    Declaration

    Swift

    func router<R>(for route: R) -> StrongRouter<R>? where R : Route

    Parameters

    route

    The route to determine a router for.

  • presented(from:) Default implementation

    This method is called whenever a Presentable is shown to the user. It further provides information about the context a presentable is shown in.

    Default Implementation

    Declaration

    Swift

    func presented(from presentable: Presentable?)

    Parameters

    presentable

    The context in which the presentable is shown. This could be a window, another viewController, a coordinator, etc. nil is specified whenever a context cannot be easily determined.

  • registerParent(_:) Default implementation

    This method is used to register a parent coordinator to a child coordinator.

    Note

    This method is used internally and should never be called directly.

    Default Implementation

    Declaration

    Swift

    func registerParent(_ presentable: Presentable & AnyObject)
  • childTransitionCompleted() Default implementation

    This method gets called when the transition of a child coordinator is being reported to its parent.

    Note

    This method is used internally and should never be called directly.

    Default Implementation

    Declaration

    Swift

    func childTransitionCompleted()
  • setRoot(for:) Default implementation

    Sets the presentable as the root of the window.

    This method sets the rootViewController of the window and makes it key and visible. Furthermore, it calls presented(from:) with the window as its parameter.

    Default Implementation

    Declaration

    Swift

    func setRoot(for window: UIWindow)

    Parameters

    window

    The window to set the root of.