Looking through a Window based application ive used to experiment with as a way of getting my head around core data, ive noticed that the appdelegate has the following code
myAppDelegate.h
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
@interface myAppDelegate : NSObject <UIApplicationDelegate> {
NSManagedObjectModel *managedObjectModel;
NSManagedObjectContext *managedObjectContext;
NSPersistentStoreCoordinator *persistentStoreCoordinator;
UIWindow *window;
UITabBarController *tabBarController;
}
myAppDelegate.m
#import "myAppDelegate.h"
@interface myAppDelegate (PrivateCoreDataStack)
@property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel;
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
@property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@end
@implementation myAppDelegate
@synthesize window, tabBarController;
// code ....
//
- (NSManagedObjectContext *) managedObjectContext {
}
- (NSManagedObjectModel *)managedObjectModel {
}
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
}
// etc.....
i want to understand a few things about what this project is doing
- why the properties in the category declaration? (if i delete the privateCoreDataStack category everything still works...)
- why the properties appear to be linked with the methods in the implementation ... managedObjectContext {} etc
- why the members in the .h file have the same name as the properties and the methods
- why code completion lets me use dot '.' to access the members but then fails on compilation say it cant find a getter
thanks !