This question is also asking what type of things I better pass as an argument to a class method vs. having as a property of a class?
For example, if we have a method func
which operates on name
of the class, then I got two options here:
@property (nonatomic) NSString *name;
- (void)func;
OR
- (void)funcWithName:(NSString*)name;
Both look as a valid design by ObjC to me.
However, it's no clear to me how the user of the class is expected to know that he will need to set the name
property before calling func
? and If this is not an appropriate usage of the property, then what use cases it is an appropriate usage for a non-readonly property?