Contents

GSSyncedDirectory

A cloud-synced directory for game-save data.

Declaration

class GSSyncedDirectory

Overview

To get an instance of the directory, call open(forContainerIdentifier:), 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 finishSyncing(_:completionHandler:) method. If you’re showing your own UI, call the finishSyncing(completionHandler:) 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 open(forContainerIdentifier:).

Topics

Accessing a directory

Syncing a directory

Resolving conflicts

Finishing with a directory