Skip to content

Instantly share code, notes, and snippets.

View ekazaev's full-sized avatar
🎓
Looking for an interesting job. Coding for fun since 1994, for food since 2003.

Eugene Kazaev ekazaev

🎓
Looking for an interesting job. Coding for fun since 1994, for food since 2003.
View GitHub Profile
//
// ChatLayout
// ChatViewController.swift
// https://github.com/ekazaev/ChatLayout
//
// Created by Eugene Kazaev in 2020-2021.
// Distributed under the MIT license.
//
import ChatLayout
@ekazaev
ekazaev / example_config.md
Last active April 8, 2019 23:10
Example configuration
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()
@ekazaev
ekazaev / storyboard_prepare.md
Last active April 8, 2019 20:56
Storyboard prepare
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
 }
// `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
    }

}