SKYFetchRecordsOperation

@interface SKYFetchRecordsOperation : SKYDatabaseOperation

is a subclass of that implements fetching records from Skygear. Use this to fetch a number of records by specifying an array of s.

When the operation completes, the will be called with all the fetched records, or an error will be returned stating the error. For each , the will be called with the fetched record or an error if one occurred.

  • Instantiates an instance of with the desired s.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithRecordIDs:
        (nonnull NSArray<SKYRecordID *> *)recordIDs;

    Swift

    init(recordIDs: [SKYRecordID])

    Parameters

    recordIDs

    An array of s of records to be fetched from Skygear.

    Return Value

    an instance of SKYFetchRecordsOperation.

  • Creates and returns an instance of with the desired s.

    Declaration

    Objective-C

    + (nonnull instancetype)operationWithRecordIDs:
        (nonnull NSArray<SKYRecordID *> *)recordIDs;

    Parameters

    recordIDs

    An array of s of records to be fetched from Skygear.

    Return Value

    an instance of SKYFetchRecordsOperation.

  • Sets or returns an array of s to be fetched from Skygear.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic)
        NSArray<SKYRecordID *> *_Nonnull recordIDs;

    Swift

    var recordIDs: [SKYRecordID] { get set }
  • Sets or returns an array of desired keys to be fetched from each record. A subset of keys for each record will be fetched from Skygear. without the specified keys will not have such key set.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic) NSArray<NSString *> *_Nonnull desiredKeys;

    Swift

    var desiredKeys: [String] { get set }
  • Sets or returns a block to be called for progress information for each . This is only called when progress information is available.

    Declaration

    Objective-C

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

    Swift

    var perRecordProgressBlock: ((SKYRecordID?, Double) -> Void)? { get set }
  • Sets or returns a block to be called when a record fetch operation completes for a . If the fetch results in an error, the error will be specified.

    This block is not called when the entire operation results in an error.

    Declaration

    Objective-C

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

    Swift

    var perRecordCompletionBlock: ((SKYRecord?, SKYRecordID?, Error?) -> Void)? { get set }
  • Sets or returns a block to be called when the entire operation completes. The fetched records are specified in an . If an error occurred for the entire operation (not individual record), an error will be specified.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic) void (^_Nullable)
        (NSDictionary *_Nullable, NSError *_Nullable) fetchRecordsCompletionBlock;

    Swift

    var fetchRecordsCompletionBlock: (([AnyHashable : Any]?, Error?) -> Void)? { get set }