Blocks

Block Rock                                     Back to iOS Resources

Blocks Rock – A Cocoa Asynchronous NSURLConnection block example | Logic High Blog

So I heard that blocks were one of the new features of 4.1 and I decided to give it a try. And it’s awesome! Within half an hour I’d solved a problem that I’d

InformIT

InformIT: Ask Big Nerd Ranch: Blocks in Objective-C

Blocks are an Apple extension to the C language. This means that you can use them not only in your Objective-C programs but in C and Objective-C++ as well. In computer science parlance blocks are known as lexical closures, but if that doesn’t mean anything to you you can think of them as nameless functions with a very useful property: they capture variables. The truly powerful aspect of blocks however is that while they can be used in a pure C context, they are full-fledged Objective-C objects, meaning they can be copied, retained, and passed around just like any other object.

Cocoa for Scientists

Cocoa for Scientists (XXXIII): 10 Uses for Blocks in C/Objective-C | MacResearch

Snow Leopard brought with it blocks (closures) for the C and Objective-C languages. Blocks at first seem to be nothing more than anonymous, inline functions, but that is only partially true, because they are also a lot like objects, carrying about their context data with them. Once you start playing with blocks, a whole new style of programming opens up to you, and you find uses for blocks in places where you may not have expected them.

Cocoa Samurai

Cocoa Samurai: A Guide to Blocks & Grand Central Dispatch (and the Cocoa API’s making use of them)

All of the content of this article applies only to Mac OS X 10.6 Snow Leopard as blocks support and Grand Central Dispatch are only available there. There are alternate methods to get blocks onto Mac OS X 10.5 and the iPhone OS via projects like Plausible Blocks which have blocks support, though do not have Grand Central Dispatch (libdispatch.)

GitHub

gist: 153676 – KVO+Blocks- GitHub

Examples of KVO and Blocks.

Using Blocks

The Pragmatic Studio | Using Blocks in iOS 4: The Basics

The Pragmatic Studio: Top developer training from the folks who wrote the books.

Using Blocks in iOS4

The Pragmatic Studio | Using Blocks in iOS 4: Designing with Blocks

The Pragmatic Studio: Top developer training from the folks who wrote the books.

Bookmark and Share

Leave a Reply