Skip to content

Instantly share code, notes, and snippets.

@atanasovdejan
Created July 30, 2018 07:49
Show Gist options
  • Save atanasovdejan/444d6d6f741688236d79aa3eafb1ef48 to your computer and use it in GitHub Desktop.
Save atanasovdejan/444d6d6f741688236d79aa3eafb1ef48 to your computer and use it in GitHub Desktop.
import UIKit
@objc protocol TestRoutingLogic
{
//func routeToSomewhere(segue: UIStoryboardSegue?)
}
protocol TestDataPassing
{
var dataStore: TestDataStore? { get }
}
class TestRouter: NSObject, TestRoutingLogic, TestDataPassing
{
weak var viewController: TestViewController?
var dataStore: TestDataStore?
// MARK: Routing
// func routeToSomewhere(segue: UIStoryboardSegue?)
// {
// if let segue = segue {
// let destinationVC = segue.destination as! SomewhereViewController
// var destinationDS = destinationVC.router!.dataStore!
// passDataToSomewhere(source: dataStore!, destination: &destinationDS)
// } else {
// let storyboard = UIStoryboard(name: "Main", bundle: nil)
// let destinationVC = storyboard.instantiateViewController(withIdentifier: "SomewhereViewController") as! SomewhereViewController
// var destinationDS = destinationVC.router!.dataStore!
// passDataToSomewhere(source: dataStore!, destination: &destinationDS)
// navigateToSomewhere(source: viewController!, destination: destinationVC)
// }
// }
// MARK: Navigation
// func navigateToSomewhere(source: TestViewController, destination: SomewhereViewController)
// {
// source.show(destination, sender: nil)
// }
//
// MARK: Passing data
//
// func passDataToSomewhere(source: TestDataStore, destination: inout SomewhereDataStore)
// {
// destination.name = source.name
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment