Reputation: 1153
If I was trying to save a CKRecord that had a title(String) and a Location(CLLocation) together so that when they were fetched, they would be downloaded as a pair would they both be in the same record or is there a better way to do it?
Upvotes: 0
Views: 414
Reputation: 1990
Creating a record that contains both fields would be the appropriate way to do it.
CloudKit allows multiple fields of various types to exist in one record type. Here's an example of the CloudKit dashboard showing a record type with both a string and a location:
To save your record, you would do something like this:
myRecord["TestString"] = title as CKRecordValue
myRecord["TestLocationCoords"] = location as CKRecordValue
Where title
is a String
and location
is a CLLocation
.
Upvotes: 4