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
Solution for Swift 4,
shows how to fetch all the records of type "YourTable", also prints System Field
and Custom Field
:
let query = CKQuery(recordType: "YourTable", predicate: NSPredicate(value: true))
CKContainer.default().publicCloudDatabase.perform(query, inZoneWith: nil) { (records, error) in
records?.forEach({ (record) in
// System Field from property
let recordName_fromProperty = record.recordID.recordName
print("System Field, recordName: \(recordName_fromProperty)")
// Custom Field from key path (eg: deeplink)
let deeplink = record.value(forKey: "deeplink")
print("Custom Field, deeplink: \(deeplink ?? "")")
})
}