findMatch(for:withCompletionHandler:)
Initiates a request to find players for a peer-to-peer match.
Declaration
func findMatch(for request: GKMatchRequest, withCompletionHandler completionHandler: (@Sendable (GKMatch?, (any Error)?) -> Void)? = nil)func findMatch(for request: GKMatchRequest) async throws -> GKMatchParameters
- request:
The configuration for the match.
- completionHandler:
The block that GameKit calls when it completes the request.
This block receives the following parameters:
matchThe match that the players join. If unsuccessful, this parameter is
nil.errorDescribes an error if it occurs, or
nilif the operation completes.
Mentioned in
Discussion
To find players using matchmaking rules, set the rules-related properties in request (queueName and optionally, properties) before you call this method. For more information, see Matchmaking rules.