Working around SBObject limitations
Working around SBObject limitations
- Subject: Working around SBObject limitations
- From: Fritz Anderson <email@hidden>
- Date: Wed, 4 Nov 2009 13:11:43 -0600
I've deduced that the SBObject subclasses derived from an
application's sdef are completely dynamic, and you can't implement
categories on them, and you can't send +class to them. Am I right?
Is there a way to work around these limitations? The application I'm
targeting implements -parent in several classes, and the return value
is polymorphic. For instance an AppFolder's parent can be another
AppFolder, but at the top of the chain, it's the AppApplication. I
want to exclude the AppApplication from my traversal of the chain.
for (id curr = [self parent]; [curr isKindOfClass: [AppFolder class]];
curr = [curr parent]) {
[returnedMutableArray insertObject: curr atIndex: 0];
}
1. The test in this for statement doesn't link, because the
AppFolder's class doesn't appear in my object code. Is there a
workaround for this?
2. It would be nice to put the above code into a -folderPath method in
my own category of the SBObject subclass AppFolder. Again, the absence
of the dynamic class from my object code prevents my implementing a
category (am I right?). Is there a workaround for this? (I imagine it
could be done by monkeying with the runtime, but I'd rather not if
there's an easier way.)
— F
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden