Saturday, March 19, 2011


Bill Bumgarner:

In particular, imp_implementationWithBlock() takes a block as a parameter, copies it to the heap, and returns a trampoline that allows the block to be used as the implementation — the IMP — of a method in any Objective-C class (as long as the block’s arguments and the method’s arguments are compatible).

Most code will never need this, but in rare cases it will be incredibly useful. Currently iOS-only, unfortunately.

2 Comments RSS · Twitter

[...] Fuller explains Apple’s implementation of imp_implementationWithBlock() and posted his own PLBlockIMP, which works on Mac OS X 10.6: On Darwin, vm_remap() provides support [...]

Happy to see that it's now available in Mac OS X Lion.

Leave a Comment