MCDownload
public class MCDownload<R: MCMirrorAbstraction>: Operation, MCDatabaseQuerier, MCCloudErrorHandler
Downloads records from specified database, converts them back to recordables and then loads them into associated receiver. Destination is the receiver’s ‘recordables’ property, an array of receiver’s associated type, but array is NOT emptied or otherwise prepared before appending results.
-
If not cancelled, this method override will decorate and launch a CKQueryOperation in the specifified database.
Declaration
Swift
public override func main()
-
This init constructs a ‘MCDownload’ operation with a predicate that attempts to match a specified field’s value.
Declaration
Swift
public convenience init(type: String, queryField: String, queryValues: [CKRecordValue], to rec: R, from db: MCDatabase)
Parameters
type
Every ‘MCDownload’ op targets a specifc recordType and this parameter is how it’s injected.
queryField
‘K’ in
%K IN %@
predicate, where K represents CKRecord Field.queryValues
‘@’ in
%K IN %@
predicate, where @ represents an array of possible matching CKRecordValue’s.to
Instance conforming to ‘RecievesRecordable’ that will ultimately recieve the results of the query.
from
‘CKDatabase’ that will be searched for records. Leave nil to search default of both private and public.
-
This init constructs a ‘MCDownload’ operation with a predicate that collects all records of the specified type.
Declaration
Swift
public convenience init(type: String, to rec: R, from db: MCDatabase)
Parameters
type
Every ‘MCDownload’ op targets a specifc recordType and this parameter is how it’s injected.
to
Instance conforming to ‘RecievesRecordable’ that will ultimately recieve the results of the query.
from
‘CKDatabase’ that will be searched for records. Leave nil to search default of both private and public.
-
This init constructs a ‘MCDownload’ operation with a custom predicate.
Declaration
Swift
public init(type: String, matching predicate: NSPredicate, to rec: R, from db: MCDatabase)
Parameters
type
Every ‘MCDownload’ op targets a specifc recordType and this parameter is how it’s injected.
predicate
The predicate for CKQuery to test against.
to
Instance conforming to ‘RecievesRecordable’ that will ultimately recieve the results of the query.
from
‘CKDatabase’ that will be searched for records. Leave nil to search default of both private and public.