ios - Code pattern / snippet for retrieving single column from cloudkit -
i'm building app allows users upload / download info common store. thought cloudkit storage ideal this.
i'd users able search records in store keyword field, download entire record when select one.
in sql terms like:
select id,keywords mydb keywords %searchstring%
followed by:
select * mydb id = selectedid
i have been using code pattern retrieve records cloudkit storage:
var publicdatabase: ckdatabase? let container = ckcontainer.defaultcontainer() override func viewdidload() { super.viewdidload() publicdatabase = container.publicclouddatabase } func performquery(){ let predicate = nspredicate(value: true) let query = ckquery(recordtype: "library", predicate: predicate) publicdatabase?.performquery(query, inzonewithid: nil, completionhandler: ({results, error in ... [code handle results / error here] ... }) }
but returns all content of each record lot of unnecessary info.
i'd fetch single field cloudkit records.
is there easy way , have code snippet?
ckfetchrecordsoperation allows downloading of restricted columns requires know ids of records download.
for can use desiredkeys property on ckqueryoperation. more information see: desiredkeys documentation
Comments
Post a Comment