On 19.10.2010, at 14:26, Bill Cheeseman wrote:
> I'm up to F in one of my frameworks, because I keep playing around with
> things that require a change in the major version.
By the way, if you'e changing the instance variable layout, a better approach
than changing the framework version each time is probably just to use a struct
for your ivars, and only have a pointer to it in your public object's ivars.
E.g.:
@interface MyPublicClass : NSObject
{
struct MyPrivateIVars* ivars;
}
@end
and then in the implementation file:
struct MyPrivateIVars
{
NSData* foo;
};
-(id) init
{
if(( self = [super init] ))
{
ivars = calloc( sizeof(struct MyPrivateIVars), 1 );
}
return self;
}
-(void) dealloc
{
free( ivars );
[super dealloc];
}
-(NSData*) foo
{
return ivars->foo;
}
Advantage is that the size of a pointer doesn't change when you add new ivars
to the MYPrivateIVars struct, so anyone using (and subclassing) your framework
can just keep using the new class.
If you have an existing ivar in each of your public classes that is at least
the size of a pointer, you can even re-purpose existing classes that need to
grow that way, thus saving you the need to do one final framework revision to
switch to this "stable" ivar layout.
Only downside is you won't be able to use @synthesize anymore.
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.masters-of-the-void.com
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]