Make custom Publisher run on a different DispatchQueue on Swift Combine

In my test of your code I'm getting false. Actually DispatchQueue has no one-to-one relation with some specific thread, it is a queue of execution and specifying DispatchQueue.global() you ask system to select some free queue to execute your task with default priority. So it is up to system to decide on which queue and in which thread to execute your task.

If you intentionally want to force it into background, then use

.subscribe(on: DispatchQueue.global(qos: .background))

Tags:

Ios

Swift

Combine