SKYModifyRecordsOperation

@interface SKYModifyRecordsOperation : SKYDatabaseOperation

is a subclass of that implements record saving to Skygear. Use this operation to save new record or modify existing record in the database.

  • Instantiates an instance of with a list of records to be saved to database.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithRecordsToSave:
        (nonnull NSArray<SKYRecord *> *)records;

    Swift

    init(recordsToSave records: [SKYRecord])

    Parameters

    records

    An array of records to be saved to database.

  • Creates and returns an instance of with a list of records to be saved to database.

    Declaration

    Objective-C

    + (nonnull instancetype)operationWithRecordsToSave:
        (nonnull NSArray<SKYRecord *> *)records;

    Parameters

    records

    An array of records to be saved to database.

  • Sets or returns an array of records to be saved to database.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic)
        NSArray<SKYRecord *> *_Nonnull recordsToSave;

    Swift

    var recordsToSave: [SKYRecord] { get set }
  • Sets whether the operation should be treated as an atomic operation. An atomic operation saves all the modifications should there be no errors. If some of the s saves successfully while some are not, the database will treat the save as not happened at all.

    The default value of this property is NO.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL atomic;

    Swift

    var atomic: Bool { get set }
  • Sets or returns a block to be called when progress information is available for saving each record.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic) void (^_Nullable)
        (SKYRecord *_Nullable, double) perRecordProgressBlock;

    Swift

    var perRecordProgressBlock: ((SKYRecord?, Double) -> Void)? { get set }
  • Sets or returns a block to be called when the save operation for individual record is completed. If an error occurred during the save, the will be specified.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic) void (^_Nullable)
        (SKYRecord *_Nullable, NSError *_Nonnull) perRecordCompletionBlock;

    Swift

    var perRecordCompletionBlock: ((SKYRecord?, Error) -> Void)? { get set }
  • Sets or returns a block to be called when the entire operation completes. If the entire operation results in an error, the will be specified.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic) void (^_Nullable)
        (NSArray<SKYRecord *> *_Nullable, NSError *_Nullable)
            modifyRecordsCompletionBlock;

    Swift

    var modifyRecordsCompletionBlock: (([SKYRecord]?, Error?) -> Void)? { get set }