Re: swizzling a class to a subclass inorder to add ivars (& methods) to a class
Re: swizzling a class to a subclass inorder to add ivars (& methods) to a class
- Subject: Re: swizzling a class to a subclass inorder to add ivars (& methods) to a class
- From: Bill Bumgarner <email@hidden>
- Date: Wed, 1 Nov 2006 21:08:41 -0800
On Nov 1, 2006, at 7:39 PM, Dustin Robert Kick wrote:
Can you access:
struct objc_ivar_list *ivars;
from a class, taking it and an objc_ivar_list that you create, and
set the "ivars" of the class to be a new objc_ivar_list created by
appending the original, and the new ivars you wish to add?
struct objc_ivar_list * newlist = (objc_ivar_list *) malloc (sizeof
(original_list) + sizeof(new_list));
then set all the ivars?
Something like that?
Well... you *could* do that, but it buys you very little.
First, it'll break all subclasses. Objective-C suffers from the
fragile base class issue in regards to instance variables. You
simply can't change the layout of the ivars of a class without
requiring all subclasses and categories (that access the ivars) to
also be recompiled in light of that new layout.
b.bum
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden