I'm trying to figure out at runtime whether a property of a class is nullable. For example:
@interface A : NSObject
+ (NSSet<NSString *> *)nullableProperties;
@property (readonly, nonatomic) NSString *description;
@property (readonly, nonatomic, nullable) NSError *error;
@end
@implementation A
+ (NSSet<NSString *> *)nullableProperties {
// Code that identifies nullable properties.
}
@end
nullableProperties
should in this case return an NSSet
with @"error"
.
property_getAttributes
function can provide information of some of the attributes (more info here). Unfortunately, it doesn't provide information on whether the property is declared as nullable.
I would like to avoid implementing nullableProperties
for every class that I need to know the nullable properties for.