I'd like to know how to fetch just the first record from a CloudKit table. For example, I have a table for "Classes" and I only want to get the class that was last modified, instead of getting all of the classes like I do now:
let pred = NSPredicate(format: "Students CONTAINS %@", studentRecord)
var query = CKQuery(recordType: "Class", predicate: pred)
publicDB.performQuery(query, inZoneWithID: nil) {
records, error in
if error != nil {
println("\(error)")
} else {
if records.count > 0 {
for record in records {
println("\(record)")
}
}
}
}
Well, there's 2 things you need for your particular scenario.
Your code should look something like this: