I just downloaded the newest iOS SDK (4.3) and noticed that when I start a Window Based Application, the UIWindow is not declared in the header file, it is only mentioned as a property.
#import <UIKit/UIKit.h>
@interface GleekAppDelegate : NSObject <UIApplicationDelegate> {
IBOutlet UILabel *label;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
I would expect, and remember from older SDK’s, that the above code should be
#import <UIKit/UIKit.h>
@interface GleekAppDelegate : NSObject <UIApplicationDelegate> {
IBOutlet UILabel *label;
UIWindow *window;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
Is that just a new feature of the SDK?
Thanks
The new Objective-C runtime has the ability to synthesize ivars without explicitly declaring them. From Runtime Difference in The Objective-C Programming Language:
…
From Runtime Versions and Platforms in Objective-C Runtime Programming Guide:
Also have a look at this questions:
Objective C: Why do we declare ivars in the .h member area if @property seems to do it automatically?
What is the underlying mechanism for ivar synthesis in the modern Objective C runtime
Automatic iVars with @synthesize