This is a follow-up question of: Why rename synthesized properties in iOS with leading underscores?
in MyDelegate.h
#import <UIKit/UIKit.h>
@interface MyAppDelegate
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) MyMainViewController *mainViewController;
@end
in MyDelegate.m
#import "MyAppDelegate.h"
@implementation MyAppDelegate
@synthesize window = _window;
@synthesize mainViewController = _mainViewController;
Besides what's explained in the original question about the benefit of the _
prefix, I am wondering why _window
is accessible
@synthesize window = _window;
without defined anywhere, before it is used for the first time?