iPhone -- initialization partly by NSKeyedUnarchiver and partly by other means
- by William Jockusch
I have an object myObj, which is an instance of a class MyClass. Some of its instance variables always have their initial values passed in by the calling code. Other instance variables will be initialized in one of two ways. For an instanceArray of type NSMutableArray, the possibilities are either
instanceArray = [[NSMutableArray alloc]init];
or
instanceArray = [someKeyedUnarchiver decodeObjectForKey: kInstanceArrayKey];
The calling code should determine which of the above will be used.
Any particular design pattern I should prefer?