-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add method to return result when popping navigation stack
- Loading branch information
Lukas Vyletel
committed
Sep 23, 2019
1 parent
c415bb1
commit e383885
Showing
11 changed files
with
123 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import AppFoundation | ||
|
||
struct SixthCoordinator: VMMCoordinator { | ||
let viewController: Weak<SixthViewController> | ||
|
||
init(viewController: SixthViewController) { | ||
self.viewController = asWeak(value: viewController) | ||
} | ||
} | ||
|
||
extension SixthCoordinator: SegueHandler { | ||
func coordinator(for segue: UIStoryboardSegue, sender: Any?) -> Coordinator? { | ||
return nil | ||
} | ||
} | ||
|
||
extension SixthCoordinator: ViewModelProvider { | ||
func provide() -> SixthViewModel { | ||
return SixthViewModel() | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import AppFoundation | ||
import RxSwift | ||
import UIKit | ||
|
||
class SixthViewController: UIViewController { | ||
let disposeBag: DisposeBag = DisposeBag() | ||
var coordinator: Coordinator! | ||
var resultListener: ResultListener! | ||
@IBOutlet weak var popWithResultButton: UIButton! | ||
} | ||
|
||
extension SixthViewController: Screen { | ||
var intents: SixthIntents { | ||
return SixthIntents( | ||
popWithResult: popWithResultButton.rx.tap.asDriver() | ||
) | ||
} | ||
|
||
func render(state: String) {} | ||
} | ||
|
||
extension SixthViewController: ResultProviderViewController {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import AppFoundation | ||
import RxCocoa | ||
import RxSwift | ||
|
||
struct SixthViewModel { | ||
let events: PublishRelay<FoundationEvent> = PublishRelay<FoundationEvent>() | ||
let state: BehaviorRelay<String> = BehaviorRelay(value: "") | ||
} | ||
|
||
extension SixthViewModel: ViewModel { | ||
func collectIntents(intents: SixthIntents) -> CompositeDisposable { | ||
return CompositeDisposable(disposables: [ | ||
intents.popWithResult | ||
.do(onNext: { self.popReturningResult(animated: true, result: "Sixth popped") }) | ||
.drive() | ||
]) | ||
} | ||
} |