Last active
April 19, 2016 14:42
-
-
Save paulofierro/4954870419e081258d50be49e3fb3ea3 to your computer and use it in GitHub Desktop.
Generify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This gives lets us use generics when compiling with Xcode 7 but will still compile using Xcode 6 | |
#if __has_feature(objc_generics) | |
#define _generify(CODE) <CODE> | |
#define _generify_dict(KEY_TYPE, VAL_TYPE) <KEY_TYPE, VAL_TYPE> | |
#else | |
#define _generify(CODE) | |
#define _generify_dict(KEY_TYPE, VAL_TYPE) | |
#endif | |
/* | |
NSArray <NSString *> *myList; | |
becomes | |
NSArray _generify(NSString *) *myList; | |
NSDictionary <NSString *, NSNumber *> *myDictionary; | |
becomes | |
NSDictionary _generify_dict(NSString *, NSNumber *) *myDictionary; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment