Saving data to CloudKit in iOS
To save date to CloudKit, we must make:
A CKRecordID (the key of your unique record)
A CKRecord (which includes data)
Making a record key
To ensure that every new record identifier is unique, we use the current timestamp, which is unique. We get the timestamp using NSDate’s method timeIntervalSinceReferenceDate(). It is in form of ###.### (# are numbers), which we will use the integer part. To do this, we split the string:
Swift
let timestamp =…