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
InitializingCSSQLiteStore
s with custom migration mapping models is currently not supported. Create anSQLiteStore
instance from Swift code and bridge the instance to Objective-C using itsSQLiteStore.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
, theDefault
configuration. Note that if you have multiple configurations, you will need to specify a differentfileURL
explicitly for each of them.localStorageOptions
When the
CSSQLiteStore
is passed to theCSDataStack
‘saddStorage()
methods, tells theCSDataStack
how to setup the persistent store. Defaults toCSLocalStorageOptionsNone
. -
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
InitializingCSSQLiteStore
s with custom migration mapping models is currently not supported. Create anSQLiteStore
instance from Swift code and bridge the instance to Objective-C using itsSQLiteStore.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 theCaches/
directory on tvOS). Note that if you have multiple configurations, you will need to specify a differentfileName
explicitly for each of them.configuration
an optional configuration name from the model file. If not specified, defaults to
nil
, theDefault
configuration. Note that if you have multiple configurations, you will need to specify a differentfileName
explicitly for each of them.localStorageOptions
When the
CSSQLiteStore
is passed to theCSDataStack
‘saddStorage()
methods, tells theCSDataStack
how to setup the persistent store. Defaults to[CSLocalStorageOptions none]
. -
Initializes an
CSSQLiteStore
with an all-default settings: afileURL
pointing to a
file in the.sqlite Application Support/
directory (or theCaches/
directory on tvOS), anil
configuration
pertaining to theDefault
configuration, andlocalStorageOptions
set to[CSLocalStorageOptions none]
.Important
InitializingCSSQLiteStore
s with custom migration mapping models is currently not supported. Create anSQLiteStore
instance from Swift code and bridge the instance to Objective-C using itsSQLiteStore.bridgeToObjectiveC
property.Declaration
Swift
@objc public convenience override init()
-
The
NSURL
that points to the SQLite fileDeclaration
Swift
@objc public var fileURL: URL { get }
-
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 }
-
Options that tell the
CSDataStack
how to setup the persistent storeDeclaration
Swift
@objc public var localStorageOptions: Int { get }
-
The string identifier for the
NSPersistentStore
‘stype
property. ForCSSQLiteStore
s, this is always set toNSSQLiteStoreType
.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
. ForCSSQLiteStore
s, 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! ThesourceModel
argument is a hint for the existing store’s model version. ForCSSQLiteStore
, 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
-
Declaration
Swift
public let bridgeToSwift: SQLiteStore
-
Declaration
Swift
public required init(_ swiftValue: SQLiteStore)