Best way to define an immutable class in Objective C
- by Patrick Marty
Hi,
I am a newbie in Objective C and I was wondering what is
the best way to define an immutable class in Objective-C (like NSString for example).
I want to know what are the basic rules one has to follow to make a class immutable.
I think that :
setters shouldn't be provided
if properties are used, they should be readonly
accessInstanceVariablesDirectly must be override and return NO
Did I forget something ?
Thanks