Mac Developer Library

Developer

GameKit Framework Reference GKTurnBasedMatchmakerViewController Class Reference

Options
Deployment Target:

On This Page
Language:

GKTurnBasedMatchmakerViewController

Inheritance


Conforms To


Import Statement


Swift

import GameKit

Objective-C

@import GameKit;

Availability


Available in OS X v10.8 and later.

The GKTurnBasedMatchmakerViewController class displays a user interface that allows players to manage the turn-based matches that they are participating in.

To show a turn-based matching user interface, first allocate and initialize a GKMatchRequest object that describes the desired match. Then, use the match request to initialize a new GKTurnBasedMatchmakerViewController object. Set the view controller’s delegate, present the view controller, and wait for the delegate to be called. The view controller’s delegate is notified when the matchmaking process is completed or canceled. Once the delegate is called, dismiss the view controller.

On iOS, you present and dismiss the view controller from another view controller in your game, using the methods provided by the UIViewController class. On OS X, you use the GKDialogController class to present and dismiss the view controller.

  • Initializes a new matchmaker view controller.

    Declaration

    Swift

    init!(matchRequest request: GKMatchRequest!)

    Objective-C

    - (id)initWithMatchRequest:(GKMatchRequest *)request

    Parameters

    request

    A match request with parameters for the match.

    Return Value

    An initialized matchmaker view controller. If an error occurred, this method returns NIL.

    Import Statement

    Objective-C

    @import GameKit;

    Swift

    import GameKit

    Availability

    Available in OS X v10.8 and later.

  • The view controller’s delegate.

    Declaration

    Swift

    unowned(unsafe) var turnBasedMatchmakerDelegate: GKTurnBasedMatchmakerViewControllerDelegate!

    Objective-C

    @property(nonatomic, readwrite, assign) id< GKTurnBasedMatchmakerViewControllerDelegate > turnBasedMatchmakerDelegate

    Discussion

    Your game must implement the delegate protocol on an object and assign that object to this property before presenting the view controller.

    Import Statement

    Objective-C

    @import GameKit;

    Swift

    import GameKit

    Availability

    Available in OS X v10.8 and later.

  • A Boolean value that determines whether the view controller shows existing matches.

    Declaration

    Swift

    var showExistingMatches: Bool

    Objective-C

    @property(nonatomic, readwrite, assign) BOOL showExistingMatches

    Discussion

    If the value of this property is YEStrue, the view controller shows matches that are already in progress. If the value of this property is NOfalse, the view controller only offers the ability to create new matches. The default value is YEStrue.

    Import Statement

    Objective-C

    @import GameKit;

    Swift

    import GameKit

    Availability

    Available in OS X v10.8 and later.