I am working on a project in which I have a model that is used by several different views and thereby viewcontrollers. These viewcontrollers have no knowledge of each others' existence, nor do they have any relationship to each other. This means that I have a model* in each of the viewcontrollers and when the views are loaded, I allocate the model in each class and make the pointers point at it. Or short: I allocate my model n times in n classes that use it, which I think is a waste of memory (not that I will run out of memory, but I think it's bad practice).
Is there a way in iOS where I (while still maintaining good MVC practice) am able to create and use the same instance of my model? Usually I have been programming in c++ where I would pass a reference to the model to the constructor of each class that should know the model. Example (c++):
// Let to classes know of the same model object
MyModel model;
ControllerA myControllerA(&model);
ControllerB myControllerB(&model);
Instead I do the following in each class that use my model (objective-c):
// ControllerA
model = [[MyModel alloc] init];
// Controller B
model = [[MyModel alloc] init];
I don't want to make all models singleton objects and in this specific project I think using an observer pattern would be an overkill.
So, my question is: How can i achieve this and is it even possible?