Skip to content

Instantly share code, notes, and snippets.

@CaliosD
Created May 31, 2017 02:37
Show Gist options
  • Save CaliosD/dbf0f4243a73baa13f57f2f05743ff33 to your computer and use it in GitHub Desktop.
Save CaliosD/dbf0f4243a73baa13f57f2f05743ff33 to your computer and use it in GitHub Desktop.
Get all properties of given class.
- (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