0

I'm currently trying to translate a tutorial for game center from Objective C into Swift and I've hit roadblock. I've been searching for about an hour and haven't been able to find anything too helpful to help me translate this callback-method:

- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFailWithError:(NSError *)error {
[viewController dismissViewControllerAnimated:YES completion:nil];
NSLog(@"Error finding match: %@", error.localizedDescription);

Sorry if this is easy (it probably is). I'm new to Swift and would love some help.. Thanks in advanced!

sadfrogger
  • 105
  • 1
  • 8

1 Answers1

1

Apple has updated most of their documentation to have both Swift and Objective-C versions of the API, so you can view the GKMatchmakerViewControllerDelegate methods there. This function would be:

func matchmakerViewController(viewController: GKMatchmakerViewController!, didFailWithError error:NSError!) {
    viewController.dismissViewControllerAnimated(true, completion: nil)
    println("Error finding match: \(error.localizedDescription)")
}
Nate Cook
  • 92,417
  • 32
  • 217
  • 178