DittoStore
@objc
public class DittoStore : NSObject
DittoStore
provides access to DittoCollection
s and a write transaction API.
-
Returns a
DittoCollection
with the provided name.Throws
DittoKitError
if there is a storage backend error.Declaration
Swift
public func collection(name: String) throws -> DittoCollection
Parameters
name
The name of the collection.
Return Value
-
Returns a list of the names of collections in the store.
Throws
DittoKitError
if there is a storage backend error.Declaration
Swift
public func collectionNames() throws -> [String]
Return Value
A list of collection names found in the store.
-
Allows you to group multiple operations together that affect multiple documents, potentially across multiple collections.
Throws
DittoKitError
if there is a storage backend error.Declaration
Swift
public func write( _ block: (DittoWriteTransaction<[String: Any?]>) -> Void ) throws -> [DittoWriteTransactionResult]
Parameters
block
A closure that provides access to a write transaction object that can be used to perform operations on the store.
Return Value
A list of
DittoWriteTransactionResult
s. There is a result for each operation performed as part of the write transaction. -
Allows you to group multiple operations together that affect multiple documents, potentially across multiple collections.
Throws
DittoKitError
if there is a storage backend error.Declaration
Swift
public func write<T: Codable>( valueType type: T.Type, _ block: (DittoWriteTransaction<T>) -> Void ) throws -> [DittoWriteTransactionResult]
Parameters
valueType
The type of the
DittoDocument
‘s value that should be used when encoding for inserting and updating documents.block
A closure that provides access to a write transaction object that can be used to perform operations on the store.
Return Value
A list of
DittoWriteTransactionResult
s. There is a result for each operation performed as part of the write transaction.