DestinationStep

@MainActor
public struct DestinationStep<VC, C> : RoutingStep, ChainableStep where VC : UIViewController

Represents a single step for the Router to make.

Associated types

  • Type of the ViewController associated with the step

    Declaration

    Swift

    public typealias ViewController = VC
  • Type of the Context associated with the step

    Declaration

    Swift

    public typealias Context = C

Methods

  • Adapts context and view controller type dependencies.

    NB: Developer guaranties that this types will compliment in runtime.

    Declaration

    Swift

    @MainActor
    public func unsafelyRewrapped<NewVC, NewC>() -> DestinationStep<NewVC, NewC> where NewVC : UIViewController
  • Transforms context using ContextTransformer provided.

    Declaration

    Swift

    @MainActor
    public func adaptingContext<T>(using contextTransformer: T) -> DestinationStep<VC, T.SourceContext> where C == T.TargetContext, T : ContextTransformer
  • Allows to avoid container view controller check.

    NB: Developer guaranties that it will be there in the runtime.

    Declaration

    Swift

    @MainActor
    public func expectingContainer<NewVC>() -> DestinationStep<NewVC, Context> where NewVC : ContainerViewController

Available where DestinationStep.Context == Any?

  • Allows to avoid container view controller check. This method is available only for the steps that are able to accept any type of context.

    NB: Developer guaranties that it will be there in the runtime.

    Declaration

    Swift

    @MainActor
    func expectingContainer<NewVC, NewC>() -> DestinationStep<NewVC, NewC> where NewVC : ContainerViewController
  • Allows to compliment to the type check. A step that has context equal to Optional(Any) can be build with any type of context passed to the router.

    Declaration

    Swift

    @MainActor
    func adaptingContext<NewC>() -> DestinationStep<ViewController, NewC>

Available where VC == UIViewController

  • Returns the root view controller of the key window.

    Declaration

    Swift

    @MainActor
    static func root<NewContext>(windowProvider: WindowProvider = RouteComposerDefaults.shared.windowProvider) -> DestinationStep<UIViewController, NewContext>
  • Returns the root view controller of the key window.

    Declaration

    Swift

    @MainActor
    static var root: DestinationStep<UIViewController, C> { get }
  • Returns the topmost presented view controller.

    Declaration

    Swift

    @MainActor
    static func current<NewContext>(windowProvider: WindowProvider = RouteComposerDefaults.shared.windowProvider) -> DestinationStep<UIViewController, NewContext>
  • Returns the topmost presented view controller.

    Declaration

    Swift

    @MainActor
    static var current: DestinationStep<UIViewController, C> { get }
  • Returns the resulting view controller of the finder provided.

    Declaration

    Swift

    @MainActor
    static func custom<F>(using finder: F) -> DestinationStep<F.ViewController, F.Context> where F : Finder

Available where VC == UINavigationController

Available where VC == UISplitViewController

Available where VC == UITabBarController