Re: Working around SBObject limitations

2009-11-04 Thread Kyle Sluder
On Wed, Nov 4, 2009 at 11:11 AM, Fritz Anderson fri...@manoverboard.org wrote:
 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?

Use +[SBApplication classForScriptingClass:].  So something like:

for (id curr = [self parent]; [curr isKindOfClass: [AppApplication
classForScriptingClass:@folder]]; curr = [curr parent]) {
   [returnedMutableArray insertObject: curr atIndex: 0];
}

 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.)

You could use the runtime methods, or you could add a category to SBObject.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com


Re: Working around SBObject limitations

2009-11-04 Thread Fritz Anderson


On 4 Nov 2009, at 1:15 PM, Kyle Sluder wrote:

On Wed, Nov 4, 2009 at 11:11 AM, Fritz Anderson fri...@manoverboard.org 
 wrote:
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?


Use +[SBApplication classForScriptingClass:].  So something like:

for (id curr = [self parent]; [curr isKindOfClass: [AppApplication
classForScriptingClass:@folder]]; curr = [curr parent]) {
  [returnedMutableArray insertObject: curr atIndex: 0];
}

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.)


You could use the runtime methods, or you could add a category to  
SBObject.


All very useful, and very straightforward. Thank you very much.

— F

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com