Re: Message Forwarding for + Methods
Re: Message Forwarding for + Methods
- Subject: Re: Message Forwarding for + Methods
- From: Guy English <email@hidden>
- Date: Tue, 6 Sep 2005 09:34:37 -0400
Hi,
You can see an example of doing this here:
http://www.kickingbear.com/Source/KBDelegatingValueTransformer.zip
The idea is when you call -(Class)class on an instance you
return a trampoline object. When a class method is called on the
trampoline it will check to see if the instance implements it. If so
the instance method is called, if not the method is called on the
real class of the instance. The code right now knows what class it's
standing in for so you may need to make that configurable in the
trampoline.
Also if anyone is interested the code implements a Value
Transformer that will use a given delegate and selector to transform
it's value instead of needing to subclass all the time. The class
methods are overridden by the instance so that +(Class)
transformedClass and +(BOOL)allowsReverseTransformation can be set on
a per-instance basis.
Hope that helps,
Guy
On 5-Sep-05, at 11:15 PM, Joe Lester wrote:
Any way to get message forwarding to work on class methods (+
methods)? I know they work for instance methods (- methods) using...
- (void)forwardInvocation:(NSInvocation *)anInvocation
But is there a way to forward messages sent to the class itself?
Thanks!
_______________________________________________
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
_______________________________________________
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