# CSSQLiteStore

    @objc
    public final class CSSQLiteStore : NSObject, CSLocalStorage, CoreStoreObjectiveCType

The `CSSQLiteStore` serves as the Objective-C bridging type for `SQLiteStore`.

See also

`SQLiteStore`

- `init(fileURL:configuration:localStorageOptions:)`

  Initializes an SQLite store interface from the given SQLite file URL. When this instance is passed to the `CSDataStack`‘s `-addStorage*:` methods, a new SQLite file will be created if it does not exist.

  Important

  Initializing `CSSQLiteStore`s with custom migration mapping models is currently not supported. Create an `SQLiteStore` instance from Swift code and bridge the instance to Objective-C using its `SQLiteStore.bridgeToObjectiveC` property.

  #### Declaration

  Swift

      @objc
      public convenience init(fileURL: URL, configuration: ModelConfiguration, localStorageOptions: Int)

  #### Parameters

  `fileURL` | the local file URL for the target SQLite persistent store. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them.
  `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 `fileURL` explicitly for each of them.
  `localStorageOptions` | When the `CSSQLiteStore` is passed to the `CSDataStack`‘s `addStorage()` methods, tells the `CSDataStack` how to setup the persistent store. Defaults to `CSLocalStorageOptionsNone`.

- `init(fileName:configuration:localStorageOptions:)`

  Initializes an SQLite store interface from the given SQLite file name. When this instance is passed to the `CSDataStack`‘s `-addStorage*:` methods, a new SQLite file will be created if it does not exist.

  Important

  Initializing `CSSQLiteStore`s with custom migration mapping models is currently not supported. Create an `SQLiteStore` instance from Swift code and bridge the instance to Objective-C using its `SQLiteStore.bridgeToObjectiveC` property.

  #### Declaration

  Swift

      @objc
      public convenience init(fileName: String, configuration: ModelConfiguration, localStorageOptions: Int)

  #### Parameters

  `fileName` | the local filename for the SQLite persistent store in the Application Support/ directory (or the Caches/ directory on tvOS). Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them.
  `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 `fileName` explicitly for each of them.
  `localStorageOptions` | When the `CSSQLiteStore` is passed to the `CSDataStack`‘s `addStorage()` methods, tells the `CSDataStack` how to setup the persistent store. Defaults to `[CSLocalStorageOptions none]`.

- `init()`

  Initializes an `CSSQLiteStore` with an all-default settings: a `fileURL` pointing to a .sqlite file in the Application Support/ directory (or the Caches/ directory on tvOS), a `nil` `configuration` pertaining to the Default configuration, and `localStorageOptions` set to `[CSLocalStorageOptions none]`.

  Important

  Initializing `CSSQLiteStore`s with custom migration mapping models is currently not supported. Create an `SQLiteStore` instance from Swift code and bridge the instance to Objective-C using its `SQLiteStore.bridgeToObjectiveC` property.

  #### Declaration

  Swift

      @objc
      public convenience override init()

- `fileURL`

  The `NSURL` that points to the SQLite file

  #### Declaration

  Swift

      @objc
      public var fileURL: URL { get }

- `migrationMappingProviders`

  An array of `SchemaMappingProvider`s that provides the complete mapping models for custom migrations. This is currently only supported for Swift code.

  #### Declaration

  Swift

      @objc
      public var migrationMappingProviders: [Any] { get }

- `localStorageOptions`

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

  #### Declaration

  Swift

      @objc
      public var localStorageOptions: Int { get }

### CSStorageInterface

- `storeType`

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

  #### Declaration

  Swift

      @objc
      public static let storeType: String

- `configuration`

  The configuration name in the model file

  #### Declaration

  Swift

      public var configuration: ModelConfiguration { get }

- `storeOptions`

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

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

  #### Declaration

  Swift

      @objc
      public var storeOptions: [AnyHashable : Any]? { get }

- `cs_eraseStorageAndWait(metadata:soureModelHint:error:)`

  Called by the `CSDataStack` 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 `CSSQLiteStore`, this converts the database’s WAL journaling mode to DELETE before deleting the file.

  #### Declaration

  Swift

      @objc
      public func cs_eraseStorageAndWait(metadata: NSDictionary, soureModelHint: NSManagedObjectModel?, error: NSErrorPointer) -> Bool

### CoreStoreObjectiveCType

- `bridgeToSwift`

  #### Declaration

  Swift

      public let bridgeToSwift: SQLiteStore

- `init(_:)`

  #### Declaration

  Swift

      public required init(_ swiftValue: SQLiteStore)