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
| target 'MVVMSetSDK' do | |
| use_frameworks! | |
| # Pods for MVVMSetSDK | |
| pod 'SetSDK' | |
| end |
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 | |
| private let setClientId = "<your client id>" | |
| private let setClientSecret = "<your client secret>" | |
| enum NavigationStackAction { | |
| case set(viewModels: [Any], animated: Bool) | |
| case push(viewModel: Any, animated: Bool) |
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 | |
| class RootViewController: UINavigationController { | |
| var viewModel: RootViewModel! | |
| private let disposeBag = DisposeBag() | |
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 |
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()) |
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 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
| ... | |
| 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 RxSwift | |
| import Set | |
| import CoreLocation | |
| class SetViewModel { | |
| // The possible events our view controller and view model can trigger | |
| enum Event { | |
| case logOut |
OlderNewer