I have an array “myArr” which contains objects of custom class..e.g. objs of type MyClass
I need to share this array across multiple classes..
Could you please help me with the exact code that I should be using..
I have referred Singleton patter on Apple and other references, but it is all ver confusing to me…So it will be great if you could highlight the things/code that I need to add.
I recommend that you read up on object delegation.
On your other classes, implement a delegate object that will point to this class, then you could use:
Edit: If you are interested to use only Singleton i believe it would be something along this way:
On your class with the array, create a class method to return a Singleton object
On your other classes you could just use
to get back the array.
Cheers.