I have 3 ViewControllers.
Each of these controllers needs to perform calculations on a given Core Data Object.
These calculations, vary considering the type of object and the controller.
The methods are,
performTimeOperations:(Year *) // VC1
performTimeOperations:(Month *) // VC2
performTimeOperations:(Day *) // VC3
It’s about 50 lines of code for each one.
But the changes in code for each of them, are so small, that I really wanted to pass an ID, like this,
performTimeOperations:(id)
And make it handle every type of object I throw at it.
Mostly because every change I make, I have to do it in 3 places.
Where would you implement this? And how?
Should I be looking at categories? I also don’t think this should go in my appDelegate … But it certainly would be a better place than to have 3 implementations of it?
Any advice is appreciated
Thank you!
Nuno
Why not make all your core data objects inherit from a common base class which implements this method?
i.e. instead of
you would have