I wrote a library for automatically creating NSUserDefaults accessories based on the properties @dynamicyou declare in the "preferences" class (see PAPreferences ). You write the property in a .m file, for example:
@property (nonatomic, assign) BOOL hasSeenIntro;
and then add it to the .h file:
@dynamic hasSeenIntro;
This works fine, but if the user accidentally forgot to insert a string @dynamic, then the compiler will automatically generate an equivalent string @synthesize. There will be no warnings, but, of course, my code will not be called for this property.
I would like to know if there is a way to disable automatic synthesis of properties for this class only.
Update:
Thanks to Nicholas, I remembered that it is possible to promote LLVM warnings for errors and wrap the announcement with this error in order to achieve the effect that I was looking for (the error will be raised if the user forgets to specify the line @dynamic):
#pragma clang diagnostic push
#pragma clang diagnostic error "-Wobjc-missing-property-synthesis"
@interface Preferences : PAPreferences
@property (nonatomic, assign) BOOL hasSeenIntro;
@property (nonatomic, assign) NSInteger pressCount;
@end
#pragma clang diagnostic pop
source
share