I encountered a problem with non-iOS developer while describing the flow of OperationQueue
. We already know that with OperationQueue
we can start as many threads as we want to execute the tasks in sync/async way.
But in practical, some of the people want proof for the OperationQueue
is getting executed in the background and not with UI(Main) thread.
I just want to demonstrate that when operation queue starts, it already starts its execution in the background.
I already have convinced that when we try to set qos
for the operationQueue that we create, it has all the parameters of global
queue's qos
viz: default
userInitiated
userInteractive
background
and utility
.
So that is already perfect example in code to prove that all the OperationQueue operations mentioned are run on global thread. Unless we declare the OperationQueue.main