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 -> GKSavedGameParameters
- 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
nilif the operation completes.
Mentioned in
Discussion
If the name parameter is an existing filename, GameKit overwrites the file with the new game data.