Created
June 26, 2018 08:30
-
-
Save hamada147/5d6963398c0aaf3ac8d26abeb4e1e69d to your computer and use it in GitHub Desktop.
While creating an NSObject in Run time I faced an issue that creating only Ivar in the created class will make it only valid for the first time use which is more like a weak reference then it will deallocate automatically which would be very helpful if you are going to use it one time only but I was going to reuse created NSObject which made thi…
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
unsigned propertyCount = 0; | |
// replace BanksModel with the class name you want to find out its attributes | |
objc_property_t *properties = class_copyPropertyList([BanksModel class], &propertyCount); | |
for (int prop = 0; prop < propertyCount; prop++) { | |
// for all property attributes | |
unsigned int attributeCount = 0; | |
objc_property_attribute_t * attributes = property_copyAttributeList(properties[prop], &attributeCount); | |
for (unsigned int attr = 0; attr < attributeCount; attr++) { | |
NSLog(@"Attribute %d: name: %s, value: %s", attr, attributes[attr].name, attributes[attr].value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment