Protocols
The following protocols are available globally.
-
Container abstracts away from the difference of
UIView
andUIViewController
With the Container protocol,
See moreUIView
andUIViewController
objects can be used interchangeably, e.g. when embedding containers into containers.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
See moreprepareTransition(for:)
method.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 moreDeclaration
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 moreDeclaration
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
See moreStrongRouter
,UnownedRouter
orWeakRouter
to reduce a coordinator’s capabilities to the triggering of routes. This may especially be useful in viewModels when using them in different contexts.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
See moreStaticTransitionAnimation
,InteractiveTransitionAnimation
andInterruptibleTransitionAnimation
classes.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 withUIPercentDrivenInteractiveTransition
.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 moreDeclaration
Swift
public protocol TransitionPerformer : Presentable
-
TransitionProtocol
is used to abstract any concrete transition implementation.
See moreTransition
is provided as an easily-extensible default transition type implementation.Declaration
Swift
public protocol TransitionProtocol : TransitionContext