The code generated by Xcode when creating a navigation based application which uses core data declares fetchedResultsController_ as private
@private
NSFetchedResultsController *fetchedResultsController_;
NSManagedObjectContext *managedObjectContext_;
Some one please explain whether there is a reason to declare it as private?
I intends to create a CommontableViewController and subclass it to use in a tab bar application with five tabs. Is there any issues if I remove the private declaration and make it protected. My compiler does not give any warning, but I am worried about the data integrity.
I believe the template also adds
@propertydeclarations for those two variables; is that correct? If so, your subclasses should useself.fetchedResultsControllerandself.managedObjectContextinstead of accessing the variables directly. That way you can maintain encapsulation and keep the variables private.The point of having them be private is that only the superclass should be responsible for setting up the storage for those objects; subclasses can just use the getter methods when they want to use them. Of course, nothing would burst into flame if you decided to make them protected, but I don’t think there’s a real need to.