Last active
January 27, 2021 06:48
-
-
Save metasmile/dff5a2009008b5f1e376 to your computer and use it in GitHub Desktop.
a macro for support ios9's new typed iterable.
This file contains 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
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 | |
#define __typed_iterable(iterablesCls, elementsType) iterablesCls<elementsType> * | |
#else | |
#define __typed_iterable(iterablesCls, elementsType) iterablesCls * | |
#endif | |
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 | |
#define __ktyped_iterable(iterablesCls, elementsType) iterablesCls<__kindof elementsType> * | |
#else | |
#define __ktyped_iterable(iterablesCls, elementsType) iterablesCls * | |
#endif | |
/* | |
//ex usage of '__typed_iterable' | |
- (__typed_iterable(NSArray,UIView *))views; | |
- (NSArray *)views; // <= ios8.x | |
- (NSArray <UIView>*)views; // >= ios9.x | |
// ex usage of '__ktyped_iterable' | |
- (__ktyped_iterable(NSArray,UIView *))views; | |
- (NSArray *)views; // <= ios8.x | |
- (NSArray <__kindof UIView>*)views; // >= ios9.x | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment