I did the simple test with DispatchQueue:
DispatchQueue.global(qos: .background).sync {
if Thread.isMainThread {
print("Main thread")
}
}
It printed out:
Main thread
Why does this code execute on the main thread? It should be performed on a background thread (it was added to a background queue), right?