^{ };


The Objective-C block utilities you always wish you had.


Many programming languages (e.g. Ruby, Python, Lisp) conceptualize a reusable self-contained "unit of work" to simplify context and scope. In these languages, they are called "closures" or "lambdas." Since OS X 10.6 and iOS 4.0, Objective-C (as well as C and C++) developers have their own: blocks.

Blocks in Objective-C are downright magical, and if you aren't using them yet, you're missing out. They make coding easier and quicker: since they're a plain-C compiler feature, they're as fast as a function call. Blocks capture all forms of scope in a declarative and expressive way. No more -[MyClass _reallyDoThing:]. No more callback hell.

The one issue with blocks to someone obnoxiously obsessive, like us, is that they aren't absolutely everywhere. iOS 4.0 introduced a number of block mechanisms, but they're still not all the way there. BlocksKit hopes to help with that.

Ideally, a block mechanism should be available everywhere where you would find:

BlocksKit supports all these and many more patterns.


Extend Foundation with simple extensions for:
  • Enumerating, filtering, and mapping the core data types
  • Key-value observing using blocks
  • Block-backed invocations
  • Delayed block execution
  • Block-backed timers
Dynamic Delegate
Embrace the power of the battle-hardened libffi to automatically replace delegates on a class. Ever wanted UIAlertView.didDismissBlock? You got it.
Replace common delegates, respond to control actions, or initialize bar button items. No more selectors, no more boilerplate.
Message UI
Present mail and text message popups, no delegate needed.