Protocols

The following protocols are available globally.

  • Container abstracts away from the difference of UIView and UIViewController

    With the Container protocol, UIView and UIViewController objects can be used interchangeably, e.g. when embedding containers into containers.

    See more

    Declaration

    Swift

    public protocol Container
  • Coordinator is the protocol every coordinator conforms to.

    It requires an object to be able to trigger routes and perform transitions. This connection is created using the prepareTransition(for:) method.

    See more

    Declaration

    Swift

    public protocol Coordinator : Router, TransitionPerformer
  • TransitionContext provides context information about transitions.

    It is especially useful for deep linking as XCoordinator can internally gather information about the presentables being pushed onto the view hierarchy.

    See more

    Declaration

    Swift

    public protocol TransitionContext
  • 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.

    See more

    Declaration

    Swift

    public protocol Presentable
  • This is the protocol your route types need to conform to.

    Note

    It has no requirements, although the use of enums is encouraged to make your navigation code type safe.

    Declaration

    Swift

    public protocol Route
  • The Router protocol is used to abstract the transition-type specific characteristics of a Coordinator.

    A Router can trigger routes, which lead to transitions being executed. In constrast to the Coordinator protocol, the router does not specify a TransitionType and can therefore be used in the form of a StrongRouter, UnownedRouter or WeakRouter to reduce a coordinator’s capabilities to the triggering of routes. This may especially be useful in viewModels when using them in different contexts.

    See more

    Declaration

    Swift

    public protocol Router : Presentable
  • TransitionAnimation aims to provide a common protocol for any type of transition animation used in an Animation object.

    XCoordinator provides different implementations of this protocol with the StaticTransitionAnimation, InteractiveTransitionAnimation and InterruptibleTransitionAnimation classes.

    See more

    Declaration

    Swift

    public protocol TransitionAnimation : UIViewControllerAnimatedTransitioning
  • PercentDrivenInteractionController is used for interaction controller types that can updated based on a percentage of completion. Furthermore, a PercentDrivenInteractionController should be able to cancel and finish a transition animation.

    PercentDrivenInteractionController is based on the UIViewControllerInteractiveTransitioning protocol.

    Note

    While you can implement your custom implementation, UIKit offers a default implementation with UIPercentDrivenInteractiveTransition.
    See more

    Declaration

    Swift

    public protocol PercentDrivenInteractionController : UIViewControllerInteractiveTransitioning
  • The TransitionPerformer protocol is used to abstract the route-type specific characteristics of a Coordinator. It keeps type information about its transition performing capabilities.

    See more

    Declaration

    Swift

    public protocol TransitionPerformer : Presentable
  • TransitionProtocol is used to abstract any concrete transition implementation.

    Transition is provided as an easily-extensible default transition type implementation.

    See more

    Declaration

    Swift

    public protocol TransitionProtocol : TransitionContext