Skip to content

Instantly share code, notes, and snippets.

@ekazaev
Created September 3, 2018 12:12
Show Gist options
  • Save ekazaev/1f2909652e7a03fc4397745f502ad5a2 to your computer and use it in GitHub Desktop.
Save ekazaev/1f2909652e7a03fc4397745f502ad5a2 to your computer and use it in GitHub Desktop.
// `RoutingDestination` is just a wrapper for the router. You can add some additional parameters that you may use in your handlers
.
struct AppDestination: RoutingDestination {

    let finalStep: RoutingStep

    let context: Any?

}

struct Configuration {

    // This method is static only for the demo
    static func productDestination(with productID: UUID) -> AppDestination {
        let productScreen = StepAssembly(finder: ProductViewControllerFinder(), factory: ProductViewControllerFactory())
                .add(LoginInterceptor())
                .add(ProductViewControllerContextTask())
                .add(ProductViewControllerPostTask(analyticsManager: AnalyticsManager.sharedInstance))
                .using(PushToNavigationAction())
                .from(NavigationControllerStep())
                .using(GenericActions.PresentModally())
                .from(CurrentControllerStep())
                .assemble()
                
        return AppDestination(finalStep: productScreen, context: productID)
    }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment