class SomeClass {
var dates: [Date] {
get {
return ckRecord.object(forKey: "dates") as! [Date]
}
set(newDates) {
ckRecord.setObject(newDates as! CKRecordValue, "dates")
}
}
}
In the previous code, how do I write code in the get and set closures to save to CloudKit and retrieve the data from CloudKit everytime I get one of the values from the array or set one of the values in the array, which means I don't retrieve the whole array or set the whole array, only one of the values at a given index as in the following code:
var obj = SomeClass()
obj.dates[0] = Date()
I don't have a problem using CloudKit. I have a problem figuring out how to arrange the code for the get and set closures so that I properly access the array from the CloudKit record by index. I am attempting to wrap the CloudKit record in class SomeClass.
Any help will be appreciated.