Last active
August 29, 2015 13:56
-
-
Save jessedc/9224416 to your computer and use it in GitHub Desktop.
Demonstrates the stricter behaviour of Xcode 5.1 in regards to overloading objective C property declarations in subclasses. -Wobjc-property-synthesis
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
#import <UIKit/UIKit.h> | |
@interface REABaseViewController : UIViewController | |
@property (nonatomic, readonly, strong) NSObject *anObject; | |
@end | |
@interface REAViewController : REABaseViewController | |
//error: auto property synthesis will not synthesize property 'anObject' | |
//because it is 'readwrite' but it will be synthesized 'readonly' via | |
//another property [-Werror,-Wobjc-property-synthesis] | |
@property (nonatomic, readwrite, strong) NSObject *anObject; | |
@end |
that makes sense to me... I think
I'm not sure this ever should have worked… it sounds like an invitation to all kinds of craziness. Redefining readonly/readwrite in a class extension within the same .h/.m has always worked, but beyond that you're just setting yourself up for undefined behaviour?
This grind my gears too, I was using it often
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code snippet compiles without warning in Xcode 5.0.2.
I've asked a question on the apple dev forums. https://devforums.apple.com/thread/220481