Hi kra,
> Just a thought, but there might be a simpler option on the objc that wouldn't involve pulling in a JSON library in a view category.
> Most, if not all, of these CF types have string conversion functions, so you could just send up the Cocoa string representation of these structs. By the end of the day, NSIndexPath is merely an array of NSUIntegers (cf -indexPathWithIndexes:length:).
>
> For instance, your objc side would be something like:
> - (void) setFrankContentOffset: (NSString *) aContentOffset animated: (BOOL) animated{
> CGPoint point = CGPointFromNSString(aContentOffset);
> [self setContentOffset: point animated: animated];
> }
>
> Your client side would have to encode the structs in the right format, but I guess there's no working around that problem.
I can explore the CF string representations. For now I don't mind pulling in a JSON library, because I can use the one that's already linked into Frank... at least until you talk Pete into separating that into its own library. ;-)
> Would be cool if frank could do some automagic type conversion like that, but I don't believe it's possible to pass CF types to performSelector:, Frank would have to drop down to objc_msgSend to do something like that, might not be worth the effort.
I wonder if it would be worthwhile (or useful) to have Frank delegate the type conversion to a set of pluggable libraries, the way it does with selector engines. In the same way that the Frankly format for queries has a 'selector_engine' field, the format for methods could have a 'type_codec' field. Then folks who are in the mood could add codecs to implement whatever conversions they need.
I can think of two ways to manage the type information, neither of which seem any damned fun:
1. The codec has a dictionary from Objective-C method signatures to parameter types. When asked to convert, the codec looks up the signature, decodes the Frankly argument strings into the types specified by the signature, and hands the values to Frank to make the call.
2. The codec has a dictionary from type names to Objective-C types. Test code sends the type name through frankly along with each argument. The codec looks up the type name, translates the Frankly argument string to the appropriate value, and hands the value to Frank to make the call.
Similarly, each codec could encode the return types.
With the first option, the codec would have to have a dictionary entry for every method you want to call. Yuck.
With the second option, the codec would have a dictionary entry for each class. That seems not so bad to me. More unfortunate is that you would need to encode the type information into the Frankly messages. I don't know whether that's horrendous or not.
Some of this is easier for the CG types, because (if I understand correctly) they're already encoded into method signatures. Still you'd need a map from CG type to CGMake...() function and NSStringFrom...() function.
Bleah.
Dale