Last active
November 25, 2020 01:54
-
-
Save esilverberg/657751eb4440ba81649856afdbf99bf9 to your computer and use it in GitHub Desktop.
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
// 🍎 | |
// In our viewDidLoad | |
viewModel.state.producer.take(duringLifetimeOf: self).startWithValues { [weak self] (state) in | |
guard let self = self else { return } | |
switch state { | |
case .initial: //... | |
case .error: //... | |
case .loading: //... | |
case .started: //... | |
case .finished: //... | |
} | |
} | |
// 🤖 | |
// In our onCreate | |
matchViewModel.matchState.observe(this, Observer { matchState -> | |
when(matchState) { | |
is MatchState.Initialized -> //... | |
is MatchState.Error -> //... | |
is MatchState.Loading -> //... | |
is MatchState.Started -> //... | |
is MatchState.Finished -> //... | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment