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
| extension ObservableType { | |
| /// Pauses the elements of the source observable sequence based on | |
| /// the latest element from the second observable sequence. | |
| /// Elements are ignored unless the second sequence has most recently | |
| /// emitted `true`. | |
| /// - Parameter pauser: The observable sequence used to pause the source | |
| /// observable sequence. | |
| /// - Returns: The observable sequence which is paused based upon | |
| /// the pauser observable sequence. |
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
| nextStepper | |
| .steps | |
| .pausable(nextPresentable.rxVisible.startWith(true)) | |
| .asDriver(onErrorJustReturn: NoStep()) | |
| .drive(onNext: { [unowned self] (step) in | |
| // the nextPresentable's Stepper fires a new Step | |
| self.steps.onNext(step) | |
| }).disposed(by: nextPresentable.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
| private var subjectContext: UInt8 = 0 | |
| /// a Stepper has only one purpose: emit Steps that correspond to | |
| /// specific navigation states. | |
| /// The state changes lead to navigation actions in the context of | |
| /// a specific Flow | |
| public protocol Stepper: Synchronizable { | |
| /// the Rx Obsersable that will trigger new Steps | |
| var steps: Observable<Step> { get } |
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
| let settingsViewController = SettingsViewController.instantiate() |
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
| public protocol StoryboardBased: class { | |
| static var storyboard: UIStoryboard { get } | |
| } | |
| public extension StoryboardBased { | |
| static var storyboard: UIStoryboard { | |
| return UIStoryboard(name: String(describing: self), bundle: Bundle(for: self)) | |
| } | |
| } |
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 ViewModelBased: class { | |
| associatedtype ViewModel | |
| var viewModel: ViewModel { get set } | |
| } |
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
| extension ViewModelBased where Self: StoryboardBased & UIViewController { | |
| static func instantiate (with viewModel: ViewModel) -> Self { | |
| let viewController = Self.instantiate() | |
| viewController.viewModel = viewModel | |
| return viewController | |
| } | |
| } |
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 MyViewController: UIViewController, StoryboardBased, ViewModelBased { | |
| var viewModel: MyViewModel! | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| } | |
| } |
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
| let myViewController = MyViewController.instantiate(with: MyViewModel()) |
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 ViewModel { | |
| associatedtype Services | |
| init (withServices services: Services) | |
| } |