I searched for many hours trying to find a solution to this closure problem in swift. I found a lot of resources to explain the closure, but for some reason I cannot get this to work.
This is the Objective-C code I'm trying to convert to fast:
[direction calculateDirectionsWithCompletionHandler:^(MKDirectionsResponse *response, NSError *error) { NSLog(@"%@",[response description]); NSLog(@"%@",[error description]); }];
and quick, I'm trying but not working:
directions.calculateDirectionsWithCompletionHandler(response: MKDirectionsResponse?, error: NSError?) { println(response.description) println(error.description) }
is an MKDirections object.
Thanks!
ios swift mapkit mkmapview routes swift-converter
Eytan schulman
source share