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
private func runAuthFlow() { | |
let coordinator = coordinatorFactory.makeAuthCoordinatorBox(router: router) | |
coordinator.finishFlow = { [weak self, weak coordinator] in | |
isAutorized = true | |
self?.start() //here we'll check instruction | |
self?.removeDependency(coordinator) | |
} | |
addDependency(coordinator) | |
coordinator.start() | |
} |
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 |
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
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
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
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(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
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
protocol Styleable { | |
func applyStyle() | |
} |