unclear use of @property in window app using core data

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-04-28T11:41:12Z Indexed on 2010/04/28 11:43 UTC
Read the original article Hit count: 201

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 iCaptureFreeAppDelegate : NSObject <UIApplicationDelegate> {


NSManagedObjectModel *managedObjectModel;
NSManagedObjectContext *managedObjectContext;       
NSPersistentStoreCoordinator *persistentStoreCoordinator;

UIWindow *window;
UITabBarController *tabBarController;

}

myAppDelegate.m

#import "myAppDelegate.h"


@interface iCaptureFreeAppDelegate (PrivateCoreDataStack)
@property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel;
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
@property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@end

@implementation iCaptureFreeAppDelegate

@synthesize window, tabBarController;

// code ....

// 
- (NSManagedObjectContext *) managedObjectContext {
}
- (NSManagedObjectModel *)managedObjectModel {
}
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
}

// etc.....

i want to understand a few things about what this project is doing

  1. why the properties in the category declaration? (if i delete the privateCoreDataStack category everything still works...)
  2. why the properties appear to be linked with the methods in the implementation ... managedObjectContext {} etc
  3. why the members in the .h file have the same name as the properties and the methods
  4. why code completion lets me use dot '.' to access the members but then fails on compilation say it cant find a getter

thanks !

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk-3.0