Declaring a block as a method parameter in Objective-C

Just a quick post as I came across an extremely helpful website dedicated to those of us who consistently need to declare Objective-C blocks in our applications. Most often, I require them when writing network operations and want to provide a callback once the operation has been completed (you could use NSOperation for this as well). Take the example below:

In the code above, we declare a callback block which takes one argument of type NSString. I think you’ll agree calling it is also quite easy.

Check this website out for more resource on objective-c block declarations.

Leave a comment