Hi, I am still new to objective-c and cocoa and the whole object-oriented approach.
So perhaps this is a weird question for you, but for me it is really important to understand. I have a small program with a DataHandler-class. This class has methods to get data from a file on the disk and to save it. Actually it reads a plist containing an Array. Now I need this Array at different places in my program. I want to display it in a menu and in a tableView. But the menu is created in a different class than the one managing the tableview. However both classes need the data from the DataHandler. So they separately initiate their own instance of DataHandler. Now the problem is that when one class changes something in the array the other class doesn't know about that, because it has its own instance of the DataHandler. Now how can I make sure that a global data-source is available independent from instances and their state? How can I share data between objects? I read something about singletons and that by declaring the DataHandler object a singleton I can make sure that over the whole program only one DataHandler-instance is initiated, and the actual Data-Array is the same in each instance. But I also read that singletons are bad practice. But how can I share data (an Array) over different objects? I still don't get this point ... Or do I have to use CoreData? _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com