Reputation: 23576
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
Upvotes: 3
Views: 515
Reputation: 28572
The new Objective-C runtime has the ability to synthesize ivars without explicitly declaring them. From Runtime Difference in The Objective-C Programming Language:
In general the behavior of properties is identical on both modern and legacy runtimes (see “Runtime Versions and Platforms” in Objective-C Runtime Programming Guide). There is one key difference: the modern runtime supports instance variable synthesis whereas the legacy runtime does not.
...
With the modern runtime, if you do not provide an instance variable, the compiler adds one for you.
From Runtime Versions and Platforms in Objective-C Runtime Programming Guide:
Phone applications and 64-bit programs on Mac OS X v10.5 and later use the modern version of the runtime.
Other programs (32-bit programs on Mac OS X desktop) use the legacy version of the runtime.
Also have a look at this questions:
Upvotes: 3