Note: This is not duplicate question I have already seen Dispatch group - cannot notify to main thread
There is nothing answered about DispatchWorkItem<
If you are running asynchronous code in a playground then you need to enable indefinite execution, otherwise execution may end before the callbacks execute.
Add the following lines to your code in the playground:
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
Once you do this, you will see that the notify executes correctly on the main queue.