Re: dispatch_async question


On Jul 19, 2017, at 6:30 AM, Dave <dave@...> wrote:

As far as I am aware, the only thing using dispatch_async does, is call the delegate sometime after the current method as returned, which I can’t see is of any benefit and makes things much hard to understand.

The call you showed runs the block on the main thread. That aspect may be crucial. Does the code this is part of run on a different thread/queue?

Also, it can often be very useful to defer some code until after the current event completes; this is often called a “delayed perform” because the old school way to do it is by calling -performSelector:withObject:afterDelay:. An async dispatch to the current queue is the moral equivalent. In the case of this statement, I couldn’t tell you why this is useful without knowing more about the code overall.


Join to automatically receive all group messages.