Why is the CoreData stack in XCode's CoreData enabled template treated as private?

Posted by rob5408 on Stack Overflow See other posts from Stack Overflow or by rob5408
Published on 2010-05-07T15:56:15Z Indexed on 2010/05/07 15:58 UTC
Read the original article Hit count: 247

Filed under:
|
|
|
|

In regards to XCode templates with CoreData enabled, I've read http://stackoverflow.com/questions/2729055/unclear-use-of-property-in-window-app-using-core-data which goes over the 'what' in the templates. But I am having an issue with the 'why'. By declaring the category in the implementation file, the CoreData accessors act like private methods. The problem with that is whenever you want to use CoreData elsewhere in your app, you need some extra code.

I've figured you need to either supply your own method that exposes the managed object context, such as...

- (NSManagedObjectContext *)getManagedObjectContext
{
    return self.managedObjectContext;
}

...which will allow other parts of your app to use it.

Or you would need to jam pack your app delegate with specific methods to return managed objects, ie getProducts or setUser.

Can anyone shed light on the reasoning here?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data