let productScreen = StepAssembly(finder: ProductViewControllerFinder(), factory: ProductViewControllerFactory())
.adding(LoginInterceptor<UUID>())
.adding(ProductViewControllerContextTask())
.adding(ProductViewControllerPostTask(analyticsManager: AnalyticsManager.sharedInstance))
.using(UINavigationController.push())
.from(NavigationControllerStep())
.using(GeneralActions.presentModally())
.from(GeneralStep.current())
.assemble()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ChatLayout | |
// ChatViewController.swift | |
// https://github.com/ekazaev/ChatLayout | |
// | |
// Created by Eugene Kazaev in 2020-2021. | |
// Distributed under the MIT license. | |
// | |
import ChatLayout |
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showDetail" {
if let indexPath = tableView.indexPathForSelectedRow {
let object = objects[indexPath.row] as! NSDate
let controller = (segue.destination as! UINavigationController).topViewController as! DetailViewController
controller.detailItem = object
controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
controller.navigationItem.leftItemsSupplementBackButton = true
}
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
//...
func application(_ application: UIApplication,
open url: URL,
sourceApplication: String?,
annotation: Any) -> Bool {
class ProductArrayViewController: UITableViewController {
let products: [UUID]?
// UITableViewControllerDelegate methods
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard let productID = products[indexPath.row] else {
return
// `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?
}
let productScreen = StepAssembly(finder: ProductViewControllerFinder(), factory: ProductViewControllerFactory(action: PushToNavigationAction()))
// Helper entities:
.add(LoginInterceptor())
.add(ProductViewControllerContextTask())
.add(ProductViewControllerPostTask(analyticsManager: AnalyticsManager.sharedInstance))
// Dependencies chain:
class ProductArrayViewController: UITableViewController {
let products: [UUID]?
// UITableViewControllerDelegate methods
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard let productID = products[indexPath.row] else {
return
class ProductViewControllerPostTask: PostRoutingTask {
let analyticsManager: AnalyticsManager
init(analyticsManager: AnalyticsManager) {
self.analyticsManager = analyticsManager
}
func execute(on productViewController: ProductViewController, for destination: AppDestination, routingStack: [UIViewController]) {
class ProductViewControllerContextTask: ContextTask {
func apply(on productViewController: ProductViewController, with productID: UUID) {
productViewController.productID = productID
}
}
NewerOlder