Skip to content

Instantly share code, notes, and snippets.

@mecid
Last active June 27, 2019 11:18
Show Gist options
  • Save mecid/030882d4fb902d0aaa30eebd11b3a19e to your computer and use it in GitHub Desktop.
Save mecid/030882d4fb902d0aaa30eebd11b3a19e to your computer and use it in GitHub Desktop.
@Published private var query: String = ""
private func fetchRepos(matching query: String) {
$query.flatMap {
self.githubService
.search(matching: $0)
.replaceError(with: [])
}
.subscribe(on: DispatchQueue.global())
.receive(on: OperationQueue.main)
.assign(to: \.repos, on: self)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment