findPlayers(forHostedRequest:withCompletionHandler:)
Initiates a request to find players for a hosted match.
Declaration
func findPlayers(forHostedRequest request: GKMatchRequest, withCompletionHandler completionHandler: (@Sendable ([GKPlayer]?, (any Error)?) -> Void)? = nil)func findPlayers(forHostedRequest request: GKMatchRequest) async throws -> [GKPlayer]Parameters
- request:
The configuration for the match.
- completionHandler:
The block that GameKit calls when it completes the request.
This block receives the following parameters:
playersThe players that join the match. 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. To get the properties of all players who join the match, use the findMatchedPlayers(_:withCompletionHandler:) method instead. For more information, see Matchmaking rules.