A few weeks ago I mentioned a library providing a number of categories to reduce the amount of code required to perform common programming tasks in Objective-C that included a few Ruby style enumerators.
Here is a library called YOLOKit from Max Howell that provides Ruby like enumeration for foundation objects providing some nice features not found in other libraries.
YoloKit provides a vast number of easy to use Ruby style enumerators as categories for NSArray, NSDictionary, NSMutableArray, NSNumber, NSSet, and NSString, and allows you to chain enumerators using a dot style syntax.
Here’s an example showing this chaining syntax in action chaining the reject, pluck, flatten and each methods:
#import "YOLO.h"
//…
campaigns.reject(^(PPCampaign *campaign){
return campaign.locked;
}).pluck(@"venues").flatten.each(^(PPVenue *venue){
[geofencer startMonitoringForRegion:venue.region];
});
You can find YOLOKit on Github here.
A great library for enumerating Foundation objects.
- Objective-C Additions For Ruby Like Iterators And More
- Open Source NSString Category Adding Many Ruby Inspired Helper Methods
- Library For Easily Working With Ruby On Rails Apps With Objective-C Code Generation
- Open Source Project Providing An API For Working With Different iOS Analytics Services
- Best Resources In iOS Development – May 14th, 2012
Original article: Open Source Objective-C Library Providing A Vast Amount Of Ruby-Style Enumerators
©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.