Added stub for custom attribute dynamic lookup

This commit is contained in:
Michael Starke
2018-09-06 09:10:56 +02:00
parent 5589f5086b
commit 3d89bc7545
2 changed files with 29 additions and 0 deletions

View File

@@ -8,6 +8,29 @@
#import "KPKEntry+MPCustomAttributeProperties.h"
NSString *const MPCustomAttributePropertyPrefix = @"valueForCustomAttribute";
@implementation KPKEntry (MPCustomAttributeProperties)
/*- (void)forwardInvocation:(NSInvocation *)anInvocation {
NSString *selector = NSStringFromSelector(anInvocation.selector);
if([selector hasPrefix:MPCustomAttributePropertyPrefix]) {
NSString *key = [selector substringFromIndex:MPCustomAttributePropertyPrefix.length];
KPKAttribute *attribute = [self attributeWithKey:key];
if(attribute) {
anInvocation.selector = @selector(value);
[anInvocation invokeWithTarget:attribute];
}
else {
anInvocation.selector = @selector(_unkownCustomAttributeValue);
[anInvocation invokeWithTarget:self];
}
}
else [super forwardInvocation:anInvocation];
}*/
- (NSString *)_unkownCustomAttributeValue {
return @"";
}
@end