Objective-C blocks are a topic that I’ve talked about several times and I’ve mentioned this in-depth guide on blocks, and this slightly more digestible blocks for beginners tutorial. Once you begin to understand blocks and start to use them you begin to start wishing that Apple would support them within more of the iOS SDK.
I’ve found an excellent library that does just that, and aims to put together all the open source Objective-C extensions supporting blocks into a polished and well documented library.
Here’s a list of some of the features provided taken from the project’s Github page:
- Performing blocks on an NSObject.
- Key-value observation (NSKeyValueObserving) using a block handler
- Associated objects using an Obj-C API. (Not directly block-related.)
- NSArray, NSSet, and NSDictionary filter utilities
- BKMacros, for more quickly typing out the above.
- NSInvocation creation using blocks
- NSTimer block execution
- UIAlertView, UIActionSheet with block callbacks
- Block initializers for UIControl and UIBarButtonItem
- Initializer for UIGestureRecognizer
- On-touch utilities for UIView.
- both delegation and block callbacks on NSURLConnection
The library is BlocksKit from Zachary Waldowski you can find the Github for the library here:
Now with this library you can experience the magic of blocks, and I really like how Zachary went to the trouble of providing documentation for everything.
Submit A Resource
Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?
You can submit the url here.
The resources we feel will appeal to our readers the most will be posted on the front page.