PersistenceStore

public protocol PersistenceStore

Protocol for persistence stores used by SynchronizationManager

  • Create a new object of the given type.

    Throws

    If a invalid type was specified

    Declaration

    Swift

    func create<T>(type: Any.Type) throws -> T

    Parameters

    type

    The type of which a new object should be created

    Return Value

    A newly created object of the given type

  • Delete objects of the given type which also match the predicate.

    Throws

    If an invalid type was specified

    Declaration

    Swift

    func delete(type: Any.Type, predicate: NSPredicate) throws

    Parameters

    type

    The type of which objects should be deleted

    predicate

    The predicate used for matching objects to delete

  • Fetches all objects of a specific type which also match the predicate.

    Throws

    If an invalid type was specified

    Declaration

    Swift

    func fetchAll<T>(type: Any.Type, predicate: NSPredicate) throws -> [T]

    Parameters

    type

    The type of which objects should be fetched

    predicate

    The predicate used for matching object to fetch

    Return Value

    An array of matching objects

  • Fetches one object of a specific type which matches the predicate.

    Throws

    If an invalid type was specified

    Declaration

    Swift

    func fetchOne<T>(type: Any.Type, predicate: NSPredicate) throws -> T

    Parameters

    type

    Type of which object should be fetched.

    predicate

    The predicate used for matching object to fetch.

    Return Value

    Matching object

  • Returns an array of names of properties the given type stores persistently.

    This should omit any properties returned by relationshipsFor(type:).

    Throws

    If an invalid type was specified

    Declaration

    Swift

    func properties(for type: Any.Type) throws -> [String]

    Parameters

    type

    The type of which properties should be returned for

    Return Value

    An array of property names

  • Returns an array of names of properties for any relationship the given type stores persistently.

    Throws

    If an invalid type was specified

    Declaration

    Swift

    func relationships(for type: Any.Type) throws -> [String]

    Parameters

    type

    The type of which properties should be returned for

    Return Value

    An array of property names

  • Performs the actual save to the persistence store.

    Throws

    If any error occured during the save operation

    Declaration

    Swift

    func save() throws
  • Deletes all the data in the database

    Declaration

    Swift

    func wipe() throws
  • Undocumented

    Declaration

    Swift

    func performBlock(block: @escaping () -> Void)
  • Undocumented

    Declaration

    Swift

    func performAndWait(block: @escaping () -> Void)
  • onStorePreseedingWillBegin(at:) Default implementation

    Called before the main .sqlite is swapped. Gives you the full file URL.

    Default Implementation

    Default: no-op. Override to remove side-car files, reset contexts, and remove the store.

    Declaration

    Swift

    func onStorePreseedingWillBegin(at storeFileURL: URL) throws
  • onStorePreseedingCompleted(at:) Default implementation

    Called after the main file is in place.

    Default Implementation

    Default: no-op. Override to re-add or re-open the store.

    Declaration

    Swift

    func onStorePreseedingCompleted(at seededFileURL: URL) throws