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
| import Foundation | |
| import UIKit | |
| func viewController(forViewModel viewModel: Any) -> UIViewController? { | |
| switch viewModel { | |
| case let viewModel as RootViewModel: | |
| let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "rootViewController") as? RootViewController | |
| viewController?.viewModel = viewModel | |
| return viewController | |
| default: |
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
| import Foundation | |
| import UIKit | |
| class RootViewController: UINavigationController { | |
| var viewModel: RootViewModel! | |
| } |
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
| import Foundation | |
| class RootViewModel { | |
| } |
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
| import Foundation | |
| import UIKit | |
| import RxSwift | |
| import MapKit | |
| class SetViewController: UIViewController, MKMapViewDelegate { | |
| var viewModel: SetViewModel! | |
| @IBOutlet weak var departingTimeLabel: UILabel! | |
| @IBOutlet weak var departingPlaceLabel: UILabel! |
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
| import Foundation | |
| import RxSwift | |
| import Set | |
| import CoreLocation | |
| class SetViewModel { | |
| // The possible events our view controller and view model can trigger | |
| enum Event { | |
| case logOut |
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 LoginViewModel { | |
| ... | |
| enum Event { | |
| case loggedIn(phoneNumber: String) | |
| } |
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
| import Foundation | |
| import UIKit | |
| import RxSwift | |
| import RxCocoa | |
| class LoginViewController: UIViewController { | |
| var viewModel: LoginViewModel! | |
| @IBOutlet weak var textField: UITextField! | |
| @IBOutlet weak var button: UIButton! |
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
| import Foundation | |
| import RxSwift | |
| import Set | |
| class LoginViewModel { | |
| enum Event { | |
| case loggedIn(phoneNumber: String) | |
| } |
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
| import UIKit | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
| window = UIWindow(frame: UIScreen.main.bounds) | |
| window?.rootViewController = viewController(forViewModel: RootViewModel()) |