Is Objective-C delegation really multithreaded?

My question is very straight forward: is the delegate design template in iOS really multithreaded? So, is actual parallel execution happening or is it still working on the main thread?

+4
source share
2 answers

It depends if you call delegate methods in another thread or not. In general, delegate methods are called on a single thread after a specific event. In short, threads have nothing to do with delegation, and in my experience, Apple always sends delegate callback methods to the main thread (however, you can refuse this, but it can become unpleasant if you do this).

+4
source

Delegation has nothing to do with streaming processing. The delegation suggested allowing one entity to make decisions on behalf of another. This is usually done in a single-threaded manner, since there is little to be gained from spawning a thread each time you want to ask a delegate something, and this will greatly complicate the design.

+3
source

Source: https://habr.com/ru/post/1369274/


All Articles