SKYRecordStorageBackingStore

@protocol SKYRecordStorageBackingStore <NSObject>

Undocumented

  • Delete data associated with this backing store.

    Declaration

    Objective-C

    - (BOOL)purgeWithError:(NSError *_Nullable *_Nullable)error;

    Swift

    func purge() throws
  • Writes data to persistent storage if the backing store supports it.

    Declaration

    Objective-C

    - (void)synchronize;

    Swift

    func synchronize()
  • Save a record in the backing store permanently.

    When saving a record using this method, any locally made changes of the same record are overwritten.

    Declaration

    Objective-C

    - (void)saveRecord:(nonnull SKYRecord *)record;

    Swift

    func save(_ record: SKYRecord)
  • Save a record in the backing store locally.

    A local record is saved alongside a permanently record (if any) such that a record can be reverted to the permanent state later. Fetches and queries will now return the locally saved record.

    Declaration

    Objective-C

    - (void)saveRecordLocally:(nonnull SKYRecord *)record;

    Swift

    func saveRecordLocally(_ record: SKYRecord)
  • Delete a record in the backing store permanently.

    When deleting a record using this method, any locally made changes of the same record are overwritten.

    Declaration

    Objective-C

    - (void)deleteRecord:(nonnull SKYRecord *)record;

    Swift

    func delete(_ record: SKYRecord)
  • Delete a record in the backing store permanently by record ID.

    Declaration

    Objective-C

    - (void)deleteRecordWithRecordID:(nonnull SKYRecordID *)recordID;

    Swift

    func deleteRecord(with recordID: SKYRecordID)
  • Delete a record in the backing store locally.

    The local record is deleted but the permanently record (if any) is not affected. Fetches and queries will not return the record that is now considered deleted.

    Declaration

    Objective-C

    - (void)deleteRecordLocally:(nonnull SKYRecord *)record;

    Swift

    func deleteRecordLocally(_ record: SKYRecord)
  • Delete a record in the backing store locally by record ID.

    Declaration

    Objective-C

    - (void)deleteRecordLocallyWithRecordID:(nonnull SKYRecordID *)recordID;

    Swift

    func deleteRecordLocally(with recordID: SKYRecordID)
  • Revert a record from its local copy to its permanent copy.

    Declaration

    Objective-C

    - (void)revertRecordLocallyWithRecordID:(nonnull SKYRecordID *)recordID;

    Swift

    func revertRecordLocally(with recordID: SKYRecordID)
  • Fetches a record from backing store.

    If both a permanent copy and a local copy exist for the same record, the local copy will be returned. If the record is deleted locally, this will return nil.

    Declaration

    Objective-C

    - (SKYRecord *_Nullable)fetchRecordWithRecordID:(nonnull SKYRecordID *)recordID;

    Swift

    func fetchRecord(with recordID: SKYRecordID) -> SKYRecord?
  • Returns whether a record from backing store exists.

    If the record is deleted locally, this will return NO.

    Declaration

    Objective-C

    - (BOOL)existsRecordWithRecordID:(nonnull SKYRecordID *)recordID;

    Swift

    func existsRecord(with recordID: SKYRecordID) -> Bool
  • Returns record ID of all records with the specified type.

    Declaration

    Objective-C

    - (nonnull NSArray *)recordIDsWithRecordType:(nonnull NSString *)recordType;

    Swift

    func recordIDs(withRecordType recordType: String) -> [Any]
  • Enumerate all records in the backing store regardless of record type.

    Declaration

    Objective-C

    - (void)enumerateRecordsWithBlock:(void (^_Nullable)(SKYRecord *_Nonnull,
                                                         BOOL *_Nonnull))block;

    Swift

    func enumerateRecords(block: ((SKYRecord, UnsafeMutablePointer<ObjCBool>) -> Void)? = nil)
  • Enumerate records in the backing store with the specified type.

    You can use this method to enumerate records satisfying a predicate and sorted in an order.

    Declaration

    Objective-C

    - (void)enumerateRecordsWithType:(nonnull NSString *)recordType
                           predicate:(NSPredicate *_Nullable)predicate
                     sortDescriptors:(NSArray *_Nullable)sortDescriptors
                          usingBlock:(void (^_Nullable)(SKYRecord *_Nonnull,
                                                        BOOL *_Nonnull))block;

    Swift

    func enumerateRecords(withType recordType: String, predicate: NSPredicate?, sortDescriptors: [Any]?, using block: ((SKYRecord, UnsafeMutablePointer<ObjCBool>) -> Void)? = nil)