I want to access properties and call methods of an Objective-C object that was returned to JavaScript host as property of exposed object ([windowScriptObject setValue:self forKey:@"a"]
):
- (id) valueForUndefinedKey:(NSString*) key {
if ( [key isEqualToString:@"b"] ) {
MyObject* obj = [ [ MyObject alloc ] init ];
return obj;
}
return Nil;
}
In Javascript I want to be able to do the following:
// a is already exposed Objective-C object
var b = a.b; // reference to myObject
var c = a.b.c; // myObject.c
var d = a.b.d(); // [ myObject d ]