CSSQLiteStore

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

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

See also

SQLiteStore
  • 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 CSSQLiteStores 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.

  • 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 CSSQLiteStores 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].

  • 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 CSSQLiteStores 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()
  • The NSURL that points to the SQLite file

    Declaration

    Swift

    @objc
    public var fileURL: URL { get }
  • An array of SchemaMappingProviders 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 }
  • Options that tell the CSDataStack how to setup the persistent store

    Declaration

    Swift

    @objc
    public var localStorageOptions: Int { get }
  • The string identifier for the NSPersistentStore‘s type property. For CSSQLiteStores, this is always set to NSSQLiteStoreType.

    Declaration

    Swift

    @objc
    public static let storeType: String
  • The configuration name in the model file

    Declaration

    Swift

    public var configuration: ModelConfiguration { get }
  • The options dictionary for the NSPersistentStore. For CSSQLiteStores, this is always set to

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

    Declaration

    Swift

    @objc
    public var storeOptions: [AnyHashable : Any]? { get }
  • 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