Skip to content

Instantly share code, notes, and snippets.

@bobgodwinx
Created June 29, 2018 10:05
Show Gist options
  • Save bobgodwinx/de9589133ca45fbe88a63f4d3186ba06 to your computer and use it in GitHub Desktop.
Save bobgodwinx/de9589133ca45fbe88a63f4d3186ba06 to your computer and use it in GitHub Desktop.
OST07
/// `ViewModel`
class ViewModel: ViewModelType {
let source: Driver<UIImage?>
let finished: Completable
init(_ model: ModelType = Model()) {
self.source = model.datasource
.map { UIImage.gif(data: $0.data) }
.asDriver(onErrorJustReturn: nil)
self.finished = model.datasource
.observeOn(MainScheduler.asyncInstance)
.take(1)
.asCompletable()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment