Why bother with a struct? Just use a class:
@interface MyEvent:NSObject
@property(copy) NSString *activity;
@property float latitude;
... etc ...
// and that linked list gunk
@property(retain) MyEvent *nextEvent;
@end
@implementation MyEvent
@synthesize activity, latitude, nextEvent;
- (void) dealloc
{
[activity release], activity = nil;
[nextEvent release], nextEvent = nil;
[super dealloc];
}
@end
There is no significant overhead vs. a structure (if the method calls are really measurable, you could even expose ivars directly). Better yet, the moment you want to archive the struct, add business logic, or do anything else interesting, you can simply add methods.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…