# ICloudStore

    @available(*, deprecated, message: "Please see the release notes and Core Data documentation.")
    public final class ICloudStore : CloudStorage

A storage interface backed by an SQLite database managed by iCloud.

- `init(ubiquitousContentName:ubiquitousContentTransactionLogsSubdirectory:ubiquitousContainerID:ubiquitousPeerToken:configuration:cloudStorageOptions:)`

  Initializes an iCloud store interface from the given ubiquitous store information. Returns `nil` if the container could not be located or if iCloud storage is unavailable for the current user or device

      guard let storage = ICloudStore(
          ubiquitousContentName: "MyAppCloudData",
          ubiquitousContentTransactionLogsSubdirectory: "logs/config1",
          ubiquitousContainerID: "iCloud.com.mycompany.myapp.containername",
          ubiquitousPeerToken: "9614d658014f4151a95d8048fb717cf0",
          configuration: "Config1",
          cloudStorageOptions: .recreateLocalStoreOnModelMismatch
      ) else {
          // iCloud is not available on the device
          return
      }
      CoreStore.addStorage(
          storage,
          completion: { result in
              // ...
          }
      )

  #### Declaration

  Swift

      public required init?(ubiquitousContentName: String, ubiquitousContentTransactionLogsSubdirectory: String, ubiquitousContainerID: String? = nil, ubiquitousPeerToken: String? = nil, configuration: ModelConfiguration = nil, cloudStorageOptions: CloudStorageOptions = nil)

  #### Parameters

  `ubiquitousContentName` | the name of the store in iCloud. This is required and should not be empty, and should not contain periods (`.`).
  `ubiquitousContentTransactionLogsSubdirectory` | a required relative path for the transaction logs
  `ubiquitousContainerID` | a container if your app has multiple ubiquity container identifiers in its entitlements
  `ubiquitousPeerToken` | a per-application salt to allow multiple apps on the same device to share a Core Data store integrated with iCloud
  `configuration` | an optional configuration name from the model file. If not specified, defaults to `nil`, the Default configuration. Note that if you have multiple configurations, you will need to specify a different `ubiquitousContentName` explicitly for each of them.
  `cloudStorageOptions` | When the `ICloudStore` is passed to the `DataStack`‘s `addStorage()` methods, tells the `DataStack` how to setup the persistent store. Defaults to `.None`.

- `addObserver(_:)`

  Registers an `ICloudStoreObserver` to start receive notifications from the ubiquitous store

  #### Declaration

  Swift

      public func addObserver<T>(_ observer: T) where T : ICloudStoreObserver

  #### Parameters

  `observer` | the observer to start sending ubiquitous notifications to

- `removeObserver(_:)`

  Unregisters an `ICloudStoreObserver` to stop receiving notifications from the ubiquitous store

  #### Declaration

  Swift

      public func removeObserver(_ observer: ICloudStoreObserver)

  #### Parameters

  `observer` | the observer to stop sending ubiquitous notifications to

### StorageInterface

- `storeType`

  The string identifier for the `NSPersistentStore`‘s `type` property. For `SQLiteStore`s, this is always set to `NSSQLiteStoreType`.

  #### Declaration

  Swift

      public static let storeType: String

- `configuration`

  The configuration name in the model file

  #### Declaration

  Swift

      public let configuration: ModelConfiguration

- `storeOptions`

  The options dictionary for the `NSPersistentStore`. For `SQLiteStore`s, this is always set to

      [NSSQLitePragmasOption: ["journal_mode": "WAL"]]

  #### Declaration

  Swift

      public let storeOptions: [AnyHashable : Any]?

- `cs_didAddToDataStack(_:)`

  Do not call directly. Used by the `DataStack` internally.

  #### Declaration

  Swift

      public func cs_didAddToDataStack(_ dataStack: DataStack)

- `cs_didRemoveFromDataStack(_:)`

  Do not call directly. Used by the `DataStack` internally.

  #### Declaration

  Swift

      public func cs_didRemoveFromDataStack(_ dataStack: DataStack)

### CloudStorage

- `cacheFileURL`

  The `NSURL` that points to the ubiquity container file

  #### Declaration

  Swift

      public let cacheFileURL: URL

- `cloudStorageOptions`

  Options that tell the `DataStack` how to setup the persistent store

  #### Declaration

  Swift

      public var cloudStorageOptions: CloudStorageOptions

- `dictionary(forOptions:)`

  The options dictionary for the specified `CloudStorageOptions`

  #### Declaration

  Swift

      public func dictionary(forOptions options: CloudStorageOptions) -> [AnyHashable : Any]?

- `cs_eraseStorageAndWait(soureModel:)`

  Called by the `DataStack` to perform actual deletion of the store file from disk. Do not call directly! The `sourceModel` argument is a hint for the existing store’s model version. For `SQLiteStore`, this converts the database’s WAL journaling mode to DELETE before deleting the file.

  #### Declaration

  Swift

      public func cs_eraseStorageAndWait(soureModel: NSManagedObjectModel) throws

### CustomDebugStringConvertible

- `debugDescription`

  #### Declaration

  Swift

      public var debugDescription: String { get }