samedi 11 juillet 2020

Objective-C Reflection - Getting generic type of NSArray

I'm currently trying to read the properties of a class with reflection in Objective-C. Its working all well expect with my NSArray.

This is my property:

@property(nonatomic) NSArray<CustomObject*>* tabs;

I can successfully access my properties of my class with:

objc_property_t *properties = class_copyPropertyList(class, &propertyCount);
for (unsigned int i = 0; i < propertyCount; i++) {
            objc_property_t property = properties[i];
            const char *propertyName = property_getName(property);
            const char *attrs = property_getAttributes(property);
}

So my property name is tabs. All good. But the attributes are "T@"NSArray",&,N,V_tabs"

How do I get the information about the generic type of my NSArray? Thx in advance





Aucun commentaire:

Enregistrer un commentaire