Contents

loadSessions(inContainer:completionHandler:)

Retrieves all of the game sessions associated with a container.

Declaration

class func loadSessions(inContainer containerName: String?, completionHandler: @escaping  @Sendable ([GKGameSession]?, (any Error)?) -> Void)
class func loadSessions(inContainer containerName: String?) async throws -> [GKGameSession]

Parameters

  • containerName:

    A unique string that identifies the container to be accessed.

  • completionHandler:

    A block that is called after all the game sessions have been loaded.

    sessions

    An array of GKGameSession objects that contains all of the game sessions associated with the specified container.

    error

    If an error occurred, this parameter holds an error object that explains the error. Otherwise, the value of this parameter is nil. See GameKit Constants for a list of error codes specific to GameKit.

See Also

Creating and Loading Game Sessions