Assemblies

  • Builds a DestinationStep instance with the correct settings into a chain of steps.

    NB

    Both Finder and Factory instances should deal with the same type of UIViewController and Context instances.

    Usage

    let productScreen = StepAssembly(finder: ProductViewControllerFinder(), factory: ProductViewControllerFactory())
            .adding(LoginInterceptor())
            .adding(ProductViewControllerContextTask())
            .adding(ProductViewControllerPostTask(analyticsManager: AnalyticsManager.sharedInstance))
            .using(UINavigationController.push())
            .from(NavigationControllerStep())
            .using(GeneralAction.presentModally())
            .from(GeneralStep.current())
            .assemble()
    
    See more

    Declaration

    Swift

    public final class StepAssembly<F: Finder, FC: AbstractFactory>: GenericStepAssembly<F.ViewController, FC.Context>
        where
        F.ViewController == FC.ViewController, F.Context == FC.Context
  • Builds a DestinationStep which can contain the conditions to select the steps to be taken by a Router.

    Usage

           let containerStep = SwitchAssembly<UINavigationController, ProductContext>()
                   .addCase { (context: ProductContext) in
                       // If this configuration is requested by a Universal Link (productURL != nil), skip this case otherwise.
                       guard context.productURL != nil else {
                           return nil
                       }
    
                       return ChainAssembly.from(NavigationControllerStep<UINavigationController, ProductContext>())
                               .using(GeneralAction.presentModally())
                               .from(GeneralStep.current())
                               .assemble()
    
                   }
    
                   // If UINavigationController is visible on the screen - use it
                   .addCase(from: ClassFinder<UINavigationController, ProductContext>(options: .currentVisibleOnly))
    
                   // Otherwise - create a UINavigationController and present modally
                   .assemble(default: ChainAssembly.from(NavigationControllerStep<UINavigationController, ProductContext>())
                       .using(GeneralAction.presentModally())
                       .from(GeneralStep.current())
                       .assemble())
    
    See more

    Declaration

    Swift

    public final class SwitchAssembly<ViewController, Context> where ViewController : UIViewController
  • Builds a chain of steps.

    See more

    Declaration

    Swift

    public enum ChainAssembly
  • Builds a ContainerFactory fulfilled with the children UIViewController factories.

    let rootFactory = CompleteFactoryAssembly(factory: TabBarFactory())
            .with(XibFactory<HomeViewController, Any?>, using: UITabBarController.add())
            .with(XibFactory<AccountViewController, Any?>, using: UITabBarController.add())
            .assemble()
    

    NB: Order matters here

    See more

    Declaration

    Swift

    public final class CompleteFactoryAssembly<FC> where FC : ContainerFactory
  • Transformer to be applied to transform one type of context to another.

    See more

    Declaration

    Swift

    public protocol ContextTransformer