Created
October 18, 2019 09:12
-
-
Save nalexn/07c50d758c808406683b3b1838ab1af9 to your computer and use it in GitHub Desktop.
Article_002 https://nalexn.github.io/mvvm-state-redundancy/
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
class PodcastsViewModel { | |
private let service: PodcastsService | |
let podcasts = BehaviorRelay<[Podcast]>(value: []) | |
func loadPodcasts() { | |
service.loadPodcasts { [weak self] result in | |
let records = result.value ?? [] | |
self?.podcasts.accept(records) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment