Does Objective-C support C# style attributes?

2020-04-17 05:12发布

问题:

Does Objective-C support marking properties/methods with attributes? like so:

#MyAttribute //sudo example
@porperty (nonatomic, retain) NSString * myString;

I would then like to "reflect" over the class and determine what attribute is attached to the property "myString".

Is something like this possible?

Thanks

回答1:

No, there are no attributes in Objective-C. You do get a form of reflection, you can test an instance to see if it exists in the instance, but that is all you get.



标签: objective-c