Skip to content

Instantly share code, notes, and snippets.

@onmyway133
Created July 4, 2018 09:07
Show Gist options
  • Save onmyway133/b22e3e229a487b01ebe771eb43bd65f7 to your computer and use it in GitHub Desktop.
Save onmyway133/b22e3e229a487b01ebe771eb43bd65f7 to your computer and use it in GitHub Desktop.
class ViewModel {
let friends: Observable<[User]>
init() {
let client = APIClient()
friends = Observable<[User]>.create({ subscriber in
client.getFacebookFriends(completion: { friends in
subscriber.onNext(friends)
subscriber.onCompleted()
})
return Disposables.create()
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment