Created
May 31, 2017 02:37
-
-
Save CaliosD/dbf0f4243a73baa13f57f2f05743ff33 to your computer and use it in GitHub Desktop.
Get all properties of given class.
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
- (NSArray *)allProperties | |
{ | |
unsigned count; | |
objc_property_t *properties = class_copyPropertyList([self class], &count); | |
NSMutableArray *rv = [NSMutableArray array]; | |
unsigned i; | |
for (i = 0; i < count; i++) | |
{ | |
objc_property_t property = properties[i]; | |
NSString *name = [NSString stringWithUTF8String:property_getName(property)]; | |
[rv addObject:name]; | |
} | |
free(properties); | |
return rv; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment