This file contains hidden or 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
| enum Guide { | |
| case headerLabel((UILabel) -> ()) | |
| case bodyLabel((UILabel) -> ()) | |
| case loginTextField((UITextField) -> ()) | |
| func identifier() -> String { | |
| switch self { | |
| case .headerLabel: return "header" | |
| case .bodyLabel: return "body" | |
| case .loginTextField: return "login" |
This file contains hidden or 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
| var headerLabel: (UILabel) -> () = { control in | |
| control.font = .systemFont(ofSize: 20) | |
| control.textColor = .red | |
| } | |
| var bodyLabel: (UILabel) -> () = { control in | |
| control.font = .systemFont(ofSize: 15) | |
| control.textColor = .darkGray | |
| } | |
| var loginTextField: (UITextField) -> () = { control in | |
| control.font = .systemFont(ofSize: 15) |
This file contains hidden or 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
| protocol Styleable { | |
| func applyStyle() | |
| } |
This file contains hidden or 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
| class MainViewController: UIViewController, Styleable { | |
| @IBOutlet weak var firstHeaderLabel: UILabel! | |
| @IBOutlet weak var secondBodyLabel: UILabel! | |
| @IBOutlet weak var loginTextField: UITextField! | |
| @IBOutlet weak var secondLoginTextField: UITextField! | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| applyStyle() |
This file contains hidden or 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
| override func start(with option: DeepLinkOption?) { | |
| //start with deepLink | |
| if let option = option { | |
| switch option { | |
| case .onboarding: runOnboardingFlow() | |
| case .signUp: runAuthFlow() | |
| default: childCoordinators.forEach { coordinator in | |
| coordinator.start(with: option) | |
| } | |
| } |
This file contains hidden or 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
| static func build(with userActivity: NSUserActivity) -> DeepLinkOption? | |
| static func build(with url: URL) -> DeepLinkOption? | |
| static func build(with dict: [String : AnyObject]?) -> DeepLinkOption? |
This file contains hidden or 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
| override func start() { | |
| switch instructor { | |
| case .onboarding: runOnboardingFlow() | |
| case .auth: runAuthFlow() | |
| case .main: runMainFlow() | |
| } | |
| } |
This file contains hidden or 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
| protocol Coordinator: class { | |
| func start() | |
| func start(with option: DeepLinkOption?) | |
| } |
This file contains hidden or 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
| func application(_ application: UIApplication, | |
| didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
| let notification = launchOptions?[.remoteNotification] as? [String: AnyObject] | |
| let deepLink = DeepLinkOption.build(with: notification) | |
| applicationCoordinator.start(with: deepLink) | |
| return true | |
| } | |
| func application(_ application: UIApplication, | |
| didReceiveRemoteNotification userInfo: [AnyHashable : Any]) { |
This file contains hidden or 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
| struct DeepLinkURLConstants { | |
| static let Onboarding = "onboarding" | |
| static let Items = "items" | |
| static let Item = "item" | |
| static let Settings = "settings" | |
| } | |
| enum DeepLinkOption { | |
| case onboarding | |
| case items |