<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameSave",
  "identifier" : "/documentation/GameSave/GSSyncedDirectory",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "GameSave"
    ],
    "preciseIdentifier" : "c:objc(cs)GSSyncedDirectory"
  },
  "title" : "GSSyncedDirectory"
}
-->

# GSSyncedDirectory

A cloud-synced directory for game-save data.

```
class GSSyncedDirectory
```

## Overview

To get an instance of the directory,
call [`open(forContainerIdentifier:)`](/documentation/GameSave/GSSyncedDirectory/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:)`](/documentation/GameSave/GSSyncedDirectory/finishSyncing(_:completionHandler:)) method.
If you’re showing your own UI,
call the [`finishSyncing(completionHandler:)`](/documentation/GameSave/GSSyncedDirectory/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()`](/documentation/GameSave/GSSyncedDirectory/close()) and then [`open(forContainerIdentifier:)`](/documentation/GameSave/GSSyncedDirectory/open(forContainerIdentifier:)).

## Topics

### Accessing a directory

[`+  openDirectoryForContainerIdentifier:`](/documentation/GameSave/GSSyncedDirectory/open(forContainerIdentifier:))

Requests an instance of the game-save directory.

[`directoryState`](/documentation/GameSave/GSSyncedDirectory/directoryState)

The state of the directory.

[`GSSyncedDirectoryState`](/documentation/GameSave/GSSyncedDirectoryState)

Represents the state and its associated properties of the directory

### Syncing a directory

[`-  finishSyncing:completionHandler:`](/documentation/GameSave/GSSyncedDirectory/finishSyncing(_:completionHandler:))

Waits for the directory sync to complete, showing the sync’s progress in a modal alert.

[`-  finishSyncingWithCompletionHandler:`](/documentation/GameSave/GSSyncedDirectory/finishSyncing(completionHandler:))

Waits for the directory sync to complete, without showing any user interface.

### Resolving conflicts

[`GSSyncedDirectoryVersion`](/documentation/GameSave/GSSyncedDirectoryVersion)

[`-  resolveConflictsWithVersion:`](/documentation/GameSave/GSSyncedDirectory/resolveConflicts(with:))

Indicates that you resolved a conflict.

### Finishing with a directory

[`-  triggerPendingUploadWithCompletionHandler:`](/documentation/GameSave/GSSyncedDirectory/triggerPendingUpload(completionHandler:))

Triggers an upload of the directory for any changes that were pending.

[`-  close`](/documentation/GameSave/GSSyncedDirectory/close())

Closes the directory, and resumes syncing the directory to the cloud.

## Relationships

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)