Instance Method

loadData(completionHandler:)

Loads previously retrieved saved game data.

Declaration

func loadData(completionHandler handler: ((Data?, Error?) -> Void)? = nil)

Parameters

handler

A block to be called after loading a saved game.

The block receives the following parameters:

data

An object that contains the retrieved saved data information.

error

If an error occurred, this parameter holds an error object that describes the problem. If the saved game data was successfully retrieved, this parameter’s value is nil.

Discussion

This method loads the saved game data asynchronously. The completion handler contains either the saved game data, or an error if no game was loaded.