In the vein of...
@implementation MyClass
- (id) objectForKeyedSubscript:(id)k {
return [self something:k];
}
Is it also possible to "subscript" Class
objects? I too, am about to find out, with you.. but thought I would post this question as I tested it out, myself...
+ (id) objectForKeyedSubscript:(id)k {
return [self.shared something:k];
}
And alas.. it is not...
id x = MyClass[@"document"];
error: unexpected interface name 'MyClass': expected expression
But why, Daddy? Class
' sure get the short end of NSObject
's stick, if you ask me.