Inherits from NSObject
Declared in SCDataFetchOptions.h

Overview

This class is used to control how data is fetched from SCDataStore. SCDataFetchOptions can be configured to have the data sorted, filtered, and/or returned in batches.

Sample use:

SCArrayOfObjectsModel *myObjectsModel = ...;
myObjectsModel.dataFetchOptions.sort = TRUE;

See also: SCDataStore, SCCoreDataFetchOptions, SCWebServiceFetchOptions

Tasks

Creation and Initialization

Configuration

  •   sort

    Set to TRUE to enable data sorting, otherwise set to FALSE. Default: FALSE.

    property
  •   sortKey

    The key that the data will be sorted against. Default: nil.

    property
  •   sortAscending

    Set to TRUE to have the sorting done in ascending order, otherwise set to FALSE. Default: TRUE.

    property
  •   filter

    Set to TRUE to enable data filtering, otherwise set to FALSE. Default: TRUE.

    property
  •   filterPredicate

    The NSPredicate that the data will be filtered against. Default: nil.

    property
  •   batchSize

    Set to the data batch size that should be retrieved. Setting this property to zero retrieves all avialable data. Default: 0.

    property

Internal Properties & Methods (should only used by the framework or when subclassing)

Properties

batchCurrentOffset

The current offset of the last retrieved batch.

@property (nonatomic, readonly) NSUInteger batchCurrentOffset

Declared In

SCDataFetchOptions.h

batchSize

Set to the data batch size that should be retrieved. Setting this property to zero retrieves all avialable data. Default: 0.

@property (nonatomic, readwrite) NSUInteger batchSize

Declared In

SCDataFetchOptions.h

batchStartingOffset

The offset of the batch that should be first retrieved. Default: 0.

@property (nonatomic, readwrite) NSUInteger batchStartingOffset

Declared In

SCDataFetchOptions.h

filter

Set to TRUE to enable data filtering, otherwise set to FALSE. Default: TRUE.

@property (nonatomic, readwrite) BOOL filter

Discussion

Note: Only applicable when filterPredicate is set to a valid NSPredicate.

Declared In

SCDataFetchOptions.h

filterPredicate

The NSPredicate that the data will be filtered against. Default: nil.

@property (nonatomic, strong) NSPredicate *filterPredicate

Declared In

SCDataFetchOptions.h

nextBatchStartIndex

The starting index for the next batch to be retrieved.

@property (nonatomic, readonly) NSUInteger nextBatchStartIndex

Declared In

SCDataFetchOptions.h

sort

Set to TRUE to enable data sorting, otherwise set to FALSE. Default: FALSE.

@property (nonatomic, readwrite) BOOL sort

Discussion

Note: Only applicable when sortKey is set to a valid key.

Declared In

SCDataFetchOptions.h

sortAscending

Set to TRUE to have the sorting done in ascending order, otherwise set to FALSE. Default: TRUE.

@property (nonatomic, readwrite) BOOL sortAscending

Discussion

Note: Only applicable when sortKey is set to a valid key.

Declared In

SCDataFetchOptions.h

sortKey

The key that the data will be sorted against. Default: nil.

@property (nonatomic, copy) NSString *sortKey

Declared In

SCDataFetchOptions.h

Class Methods

options

Allocates and returns an initialized SCDataFetchOptions object.

+ (id)options

Declared In

SCDataFetchOptions.h

optionsWithSortKey:sortAscending:filterPredicate:

Allocates and returns an initialized SCDataFetchOptions object given the sorting and filtering configuration.

+ (id)optionsWithSortKey:(NSString *)key sortAscending:(BOOL)ascending filterPredicate:(NSPredicate *)predicate

Parameters

key

The key that the data will be sorted against. Passing a non nil value for ‘key’ also sets the sort property to TRUE.

predicate

The NSPredicate that the data will be filtered against. Passing a non nil value for ‘predicate’ also sets the filter property to TRUE.

Declared In

SCDataFetchOptions.h

Instance Methods

filterMutableArray:

Filters the given array based on the current filtering configuration.

- (void)filterMutableArray:(NSMutableArray *)array

Declared In

SCDataFetchOptions.h

incrementBatchOffset

Increments the current batch offset.

- (void)incrementBatchOffset

Discussion

Warning: Reserved for internal framework use only.

Declared In

SCDataFetchOptions.h

initWithSortKey:sortAscending:filterPredicate:

Returns an initialized SCDataFetchOptions object given the sorting and filtering configuration.

- (id)initWithSortKey:(NSString *)key sortAscending:(BOOL)ascending filterPredicate:(NSPredicate *)predicate

Parameters

key

The key that the data will be sorted against. Passing a non nil value for ‘key’ also sets the sort property to TRUE.

predicate

The NSPredicate that the data will be filtered against. Passing a non nil value for ‘predicate’ also sets the filter property to TRUE.

Declared In

SCDataFetchOptions.h

resetBatchOffset

Resets the current batch offset.

- (void)resetBatchOffset

Discussion

Warning: Reserved for internal framework use only.

Declared In

SCDataFetchOptions.h

setBatchOffset:

Sets the current batch offset.

- (void)setBatchOffset:(NSUInteger)offset

Discussion

Warning: Reserved for internal framework use only.

Declared In

SCDataFetchOptions.h

sortDescriptors

Returns an array of sort-descriptors based on the current sorting configuration.

- (NSArray *)sortDescriptors

Declared In

SCDataFetchOptions.h

sortMutableArray:

Sorts the given array based on the current sorting configuration.

- (void)sortMutableArray:(NSMutableArray *)array

Declared In

SCDataFetchOptions.h