Contents

GameSaveSyncedDirectory

A cloud-synced directory for game-save data.

Declaration

class GameSaveSyncedDirectory

Overview

To get an instance of the directory, call openDirectory(containerIdentifier:), which returns the directory for the iCloud container associated with the specified identifier. Calling this method starts syncing the directory in the background on the specified container. When the game needs to access the contents of the directory, show a UI while the directory fully syncs using the gameSaveSyncingAlert(directory:finishedLoading:) view extension if your app uses SwiftUI, the finishSyncing(statusDisplay:) method if your app uses UIKit, or the finishSyncing(statusDisplay:) method if your app uses AppKit.

If you’re showing your own UI, call the finishSyncing() method to wait for the directory to finish syncing.

After the directory is ready to use, syncing pauses until you close the directory object or the object is deallocated. To resume syncing during the game, close and re-open the directory by calling close() and then openDirectory(containerIdentifier:).

Topics

Accessing a directory

Syncing a directory

Resolving conflicts

Finishing with a directory