class UserProfileViewController: UIViewController, DataReceivingViewController {
typealias DataType = User
func didReceiveData(_ data: User) {
// configure UI with data
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
import UIKit | |
import CoreNavigation | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
// register PersonProfile routable destination | |
PersonProfile.register() | |
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
import CoreNavigation | |
extension PersonProfile: Routable { | |
static var patterns: [String] = [ | |
"https://appdomain.com/person/:personId(.*)", | |
"https://appdomain.com/user/:personId(.*)" | |
] | |
} |
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
import CoreNavigation | |
class PersonProfileViewController: UIViewController, DataReceivable { | |
// DataReceivable associatedtype | |
typealias DataType = Person | |
func didReceiveData(_ data: Person) { | |
// configure UI with data | |
} |
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
import CoreNavigation | |
struct PersonProfile: Destination { | |
typealias ViewControllerType = PersonProfileViewController | |
let personId: String | |
init(_ personId: String) { | |
self.personId = personId | |
} |
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
extension Array { | |
func flattened<T>() -> [T] where Element == T? { | |
return flatMap { $0 } | |
} | |
} | |
let array: [String?] = [ | |
"gimme", | |
"some", | |
nil, |
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
import Foundation | |
import ARoute | |
enum RouteTransitionType { | |
case pushWithDelegate(navigationControllerDelegate: UINavigationControllerDelegate) | |
case push | |
case modal | |
case custom(transitioningDelegate: UIViewControllerTransitioningDelegate) | |
func performTransition(routeRequest: ARouteRequestExecutable) { |
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
import Foundation | |
import ARoute | |
enum RouteEmbeddingType { | |
case navigationController | |
case tabBarController | |
} |
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
import UIKit | |
import ARoute | |
final class HomeViewController: UIViewController, ARoutable { | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
} | |
required init?(routeResponse: ARouteResponse) { | |
super.init(nibName: nil, bundle: nil) |