AnyCoordinator
public class AnyCoordinator<RouteType, TransitionType> : Coordinator where RouteType : Route, TransitionType : TransitionProtocol
AnyCoordinator
is a type-erased Coordinator
(RouteType
& TransitionType
) and
can be used as an abstraction from a specific coordinator class while still specifying
TransitionType and RouteType.
Note
If you do not want/need to specify TransitionType, you might want to look into the different router abstractionsStrongRouter
, UnownedRouter
and WeakRouter
.
See AnyTransitionPerformer
to further abstract from RouteType.
-
Creates a type-erased Coordinator for a specific coordinator.
A strong reference to the source coordinator is kept.
Declaration
Swift
public init<C>(_ coordinator: C) where RouteType == C.RouteType, TransitionType == C.TransitionType, C : Coordinator
Parameters
coordinator
The source coordinator.
-
Declaration
Swift
public var rootViewController: TransitionType.RootViewController { get }
-
Declaration
Swift
public var viewController: UIViewController! { get }
-
Prepare and return transitions for a given route.
Declaration
Swift
public func prepareTransition(for route: RouteType) -> TransitionType
Parameters
route
The triggered route for which a transition is to be prepared.
Return Value
The prepared transition.
-
Declaration
Swift
public func presented(from presentable: Presentable?)
-
Declaration
Swift
public func registerParent(_ presentable: Presentable & AnyObject)
-
Declaration
Swift
public func setRoot(for window: UIWindow)
-
Declaration
Swift
public func addChild(_ presentable: Presentable)
-
Declaration
Swift
public func removeChild(_ presentable: Presentable)
-
Declaration
Swift
public func removeChildrenIfNeeded()