iPhone -- initialization partly by NSKeyedUnarchiver and partly by other means
Posted
by William Jockusch
on Stack Overflow
See other posts from Stack Overflow
or by William Jockusch
Published on 2010-04-13T04:11:04Z
Indexed on
2010/04/13
4:12 UTC
Read the original article
Hit count: 387
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?
© Stack Overflow or respective owner