I\'m making an app, and I have a class with quite a lot properties and I was wondering if it was possible to give them a default value. Because if I make an init method, it\'s a
The dictionary suggestion above is a good one. I've sometimes used dedicated configuration objects:
@interface GoalKeepingAttributes
@property (nonatomic) int agression
@property (nonatomic) int ... etc
@end
@implementation GoalKeepingAttributes
@end
etc. If needed, this class could have an init method that sets a bunch of values and defaults.
You could probably use a c-style struct as well, since these are just primitives.
It's true that this is merely deferring the problem, moving the initialization from the one class to the config class, but:
You could split up the configurations into different types (Goalkeeping, Technical, and Mental). Again, it's just splitting up the problem, but that can help keeping things focused.