I realize that what counts as premature optimization has a subjective component, but this is an empirical or best-practices question.
When programming for iOS, should I prefer using struct
and typedefs where the object has no "behavior" (methods, basically)? My feeling is that the struct
syntax is a bit strange for a non-C person, but that it should be WAY lower profile. Then again, testing some cases with 50K NSObject
instances, it doesn't seem bad (relative, I know). Should I "get used to it" (use structs where possible) or are NSObject
instances okay, unless I have performance problems?
The typical case would be a class with two int
member variables. I've read that using a struct to hold two NSString
instances (or any NSObject
subclass) is a bad idea.