Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8970743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:46:56+00:00 2026-06-15T17:46:56+00:00

I am an average iOS developer. The first design pattern that I saw heavily

  • 0

I am an average iOS developer. The first design pattern that I saw heavily being used was Delegation pattern which was mostly being used for callback functionality.

Now that blocks are there in Objective C and I am seeing more and more libraries heavily using them and avoiding delegates, I am wondering, are blocks permanent replacement for delegate pattern using protocols ?

I recently used MKNetworkKit in a project, I created a wrapper class on top of it, the library is block based so all my code that would encapsulate a call to one of there block based code turned ot to be another block based code.

I found that it was very convenient initially, but was difficult to debug and modify as the code looked complex (callback inside callback inside callback!)

Any tips on when to use what and certain best practices ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:46:57+00:00Added an answer on June 15, 2026 at 5:46 pm

    Delegates and blocks are both used for something to “call back” the result, usually to the thing that created it. There are some differences:

    • Using a delegate protocol, the method names you must implement to receive the callback are fixed. That means, if you need to receive callbacks from multiple possible actions using the same delegate protocol, you must somehow distinguish them. With blocks, there are no fixed names; you simply pass a block object with a particular signature. You can pass different block objects to different actions.
    • Delegate protocols often (but not always) contain more than one callback method, e.g. a “success” and a “failure” callback. Each block can only serve as one callback. Many libraries try to “combine” multiple delegate callbacks into a single block callback, by using multiple arguments, e.g. the block has two arguments (result, error), where if “error” is nil it corresponds to the original “success” callback, with “result” being the data; and if “error” is not nil, it corresponds to the original “failure” callback. Another option would be to give multiple blocks separately to the action (e.g. it has a “success block” property, and “failure block” property, which you can set). This is more general, and will work as a one-to-one replacement of a delegate protocol with any number of methods.
    • Memory management: Delegates are usually weakly-referenced, since the delegate is usually a “parent” object that owns the delegator. However, blocks are strongly referenced, since blocks are one-use things that are not needed anymore once passed to the delegator. However, if you think about it, it is not really different. With delegates, typically the delegate method will perform some action on itself (the parent object). With blocks, in order to do this, the block would need a reference to the “parent”. It is then this reference that needs to be a weak reference, to emulate the memory management of the delegate pattern. With blocks, the parent object code has more control over how the delegate will reference it, because it sets up the block.

    In conclusion, it is possible to systematically convert any API using a delegate protocol into one that uses blocks, with what I described above — for each delegate method, add one block property on the delegator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to average some .jpg images which are corrupted by zero-mean Gaussian additive
I would like to average across Rows in a column. That is rows that
I average over a multiple solutions of ODEs that have different initial conditions, so
What is the average time that it would take a complete novice, whose background
I had an average function in my spreadsheet that was working well: =AVERAGE( IF('Sheet2'!$2:$2=Tuesday,
What is the average case complexity of the following function given that the input
Wikipedia states that the average runtime of quickselect algorithm ( Link ) is O(n).
I'm an average web developer. Just want to find out if it's advisable to
It may sound strange that knowing a lot about iOS and having some experience
On average, how long does it take for Debian to package new versions of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.