I tried calling the objective-c method from swift and got this strange error:
Cannot convert the expression type 'Void' to type 'String!'
Quick code:
XNGAPIClient.sharedClient().putUpdateGeoLocationForUserID("me",
accuracy: 3000,
latitude: location.coordinate.latitude as CGFloat,
longitude: location.coordinate.longitude as CGFloat,
ttl: 420, success: { (JSON: AnyObject!) in },
failure: { (error: NSError!) in })
Objective-C Method:
- (void)putUpdateGeoLocationForUserID:(NSString*)userID
accuracy:(CGFloat)accuracy
latitude:(CGFloat)latitude
longitude:(CGFloat)longitude
ttl:(NSUInteger)ttl
success:(void (^)(id JSON))success
failure:(void (^)(NSError *error))failure
If I convert everything to the suggested types:
XNGAPIClient.sharedClient().putUpdateGeoLocationForUserID("me" as String,
accuracy: 3000 as CGFloat,
latitude: location.coordinate.latitude as CGFloat,
longitude: location.coordinate.longitude as CGFloat,
ttl: 420 as Int,
success: { (JSON: AnyObject!) in },
failure: { (error: NSError!) in })
I get the following error: Cannot convert the expression type 'Void' to type 'StringLiteralConvertible'
source
share