Search code examples
swiftgame-centermultiplayer

Swift syntax for GKMatchmaker.matchForInvite


Does somebody know how to write Game Center invitation handling correctly? I cannot figure out the right syntax for this line:

GKMatchmaker.matchForInvite (Invitation:GKInvite!, completionHandler .....

Please help, I am stuck!


Solution

  • I know this is an old question but I just came across it and thought i'd offer my two cents.

    this is how i implemented that function

    GKMatchmaker.sharedMatchmaker().matchForInvite(invite, completionHandler: { (match: GKMatch!, error: NSError!) -> Void in
    
       if error != nil {
          // error out
       }
    
       if match != nil {
    
          // success   
       }
     })