Skip to content

Instantly share code, notes, and snippets.

@nalexn
Created October 18, 2019 09:12
Show Gist options
  • Save nalexn/07c50d758c808406683b3b1838ab1af9 to your computer and use it in GitHub Desktop.
Save nalexn/07c50d758c808406683b3b1838ab1af9 to your computer and use it in GitHub Desktop.
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