Skip to content

Instantly share code, notes, and snippets.

@eunjin3786
Created June 28, 2019 05:48
Show Gist options
  • Save eunjin3786/3c032cb327dca3a6de4f6a41b80ce9c5 to your computer and use it in GitHub Desktop.
Save eunjin3786/3c032cb327dca3a6de4f6a41b80ce9c5 to your computer and use it in GitHub Desktop.
let backgroundQueue = DispatchQueue.global(qos: .background)
Publishers.Just(1)
.map { _ in
print(Thread.isMainThread) // true
}
.subscribe(on: backgroundQueue)
.map { _ in
print(Thread.isMainThread) // false
}.sink {
print(Thread.isMainThread) // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment