Search code examples
objective-ciosdelegatesobjective-c-blocks

ObjC using blocks with progress delegate


From the next blog http://thejoeconwayblog.wordpress.com/2012/05/29/blocks-or-delegation/
one of the main differences between delegate callbacks and blocks is "Process vs. Results"

My question is:
I want to use blocking for starting a process with completion, but during the process i want to notify the caller with the process steps. is it better to use delegate callbacks or blocks with a delegate callback only for my progress notification ?


Solution

  • There is no better or worse. Both alternatives will do the job.

    Commonly blocks are more elegant and demand less boilerplate code. On the other hand, delegation, from my point of view, is often easier to understand when reading someone else's code.

    I do not see the point in combining both, delegation and blocks - I personally would refrain from doing so.