I have currently got CloudKit set up in my app so that I am adding a new record using the help of the following code below,
CKRecordID *recordID
Here's the answer in Swift 3.0.
func myQuery() {
let predicate = NSPredicate(value: true)
let query = CKQuery(recordType: "tableName", predicate: predicate)
publicDatabase.perform(query, inZoneWith: nil) { (record, error) in
for record: CKRecord in record! {
//...
// if you want to access a certain 'field'.
let name = record.value(forKeyPath: "Name") as! String
}
}
}