Contents

saveGameData(_:withName:completionHandler:)

Saves game data with the specified name.

Declaration

func saveGameData(_ data: Data, withName name: String, completionHandler handler: (@Sendable (GKSavedGame?, (any Error)?) -> Void)? = nil)
func saveGameData(_ data: Data, withName name: String) async throws -> GKSavedGame

Parameters

  • data:

    An object that contains the saved game data.

  • name:

    A unique filename for the saved game data.

  • handler:

    The block that this method calls when it completes the request.

    The block receives the following parameters:

    savedGame

    The saved game.

    error

    Describes an error if it occurs, or nil if the operation completes.

Mentioned in

Discussion

If the name parameter is an existing filename, GameKit overwrites the file with the new game data.

See Also

Saving Game Data