A couple of months ago I mentioned an interesting library allowing you to easily define your own Objective-C literals that included a number of pre-made literals allowing you to dramatically reduce the size of your Objective-C code syntax. I also mentioned a nice collection of macros for shortening your code a couple of years back.
Here’s a library called Objective-Shorthand from Saroush Khanlou providing a number of categories to reduce the syntax when performing many common tasks.
Some of the categories included simplify:
– Regular Expressions: Pattern creation and match checking in a single step.
– JSON: A JSONKit style interface using Apple’s built-in JSON serializer.
– NSComparisonMethods: The Same API as in the OS X SDK with iOS Support for easier comparisons.
– Data Detection Methods: Check if Data is an E-mail, url, phone number, date or address.
– NSArray Convenience Methods: Make arrays unique, sort arrays
– Functional Collection Operators: Adds Map, Select and Any to NSArray, NSSet, NSDictionary
– String Methods: Check if contains, compare ignoring case
And much more – there is solid documentation for each method.
You can find Objective-Shorthand on Github here.
A very nice collection of categories.
- NSRegularExpression Category With An Extensive Number Of Helpers For Easier Regular Expressions
- Tutorial: Instance Variables In Objective-C Categories
- Objective-C Utility Class Inspired By Underscore.js Providing Collection Helpers And More
- What are Objective-C categories?
- Using Objective-C JSON To Do Translations In An iOS App
Original article: Categories To Shorten Your Objective-C Code Including JSON Helpers, And NSComparisonMethods For iOS
©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.