I have an NSString subclass as below.
If the subclass doesn’t respond to a given selector I want to forward the
selector to another object.
What is the best way to declare the interfaces for DBManagedString and
DBManagedObject?
Should I declare a DBManagedObject protocol in which all the methods are
optional?
And what happens with synthesis for properties declared in protocols?
@interface DBManagedString : NSString
- (id)initWithMonoString:(MonoString *)monoString;
- (MonoString *)representedMonoString;
@end
@implementation DBManagedString
- (id)forwardingTargetForSelector:(SEL)aSelector
{
#pragma unused(aSelector)
if (!self.forwardingTarget) {
self.forwardingTarget = [DBManagedObject
objectWithMonoObject:(MonoObject *)self.representedMonoString];
}
return self.forwardingTarget;
}
@end
Jonathan
_______________________________________________
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]