def _valueToNSObject(value, nstype): '''Convert a string with a type specifier to a native Objective-C NSObject (serializable).''' return { 'string': lambda v: NSString.stringWithUTF8String_(v), 'int': lambda v: NSNumber.numberWithInt_(v), 'float': lambda v: NSNumber.numberWithFloat_(v), 'bool': lambda v: True if v == 'true' else False, 'data': lambda v: NSData.initWithBytes_length_(v, len(v)) }[nstype](value)
def _valueToNSObject(value, nstype): '''Convert a string with a type specifier to a native Objective-C NSObject (serializable).''' return { 'string': lambda v: NSString.stringWithUTF8String_(v), 'int': lambda v: NSNumber.numberWithInt_(v), 'float': lambda v: NSNumber.numberWithFloat_(v), 'bool': lambda v: True if v == 'true' else False, 'data': lambda v: NSData.initWithBytes_length_(v, len(v)) }[nstype](value)