Assemblies
-
Builds a
DestinationStep
instance with the correct settings into a chain of steps.NB
Both
Finder
andFactory
instances should deal with the same type ofUIViewController
andContext
instances.Usage
See morelet 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()
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 aRouter
.Usage
See morelet 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())
Declaration
Swift
public final class SwitchAssembly<ViewController, Context> where ViewController : UIViewController
-
Builds a chain of steps.
See moreDeclaration
Swift
public enum ChainAssembly
-
Builds a
ContainerFactory
fulfilled with the childrenUIViewController
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 moreDeclaration
Swift
public final class CompleteFactoryAssembly<FC> where FC : ContainerFactory
-
Transformer to be applied to transform one type of context to another.
See moreDeclaration
Swift
public protocol ContextTransformer