The operation:
operation.recordMatchedBlock = {recordID, result in
switch result {
case .success(let record):
print("RecordID: \(recordID), record: \(record)")
let order = Order()
order.recordID = record.recordID
order.name = record["name"]
order.products = record["products"]
newOrders.append(order)
orders = newOrders
case .failure(let error):
print("failed for \(recordID): \(error)")
}
}
And here is my model:
class Order:NSObject, Identifiable {
var recordID: CKRecord.ID!
var name: String!
var products: [String]?
}
My record from the public database consists of an array(StringList) - "products".
My problem is that the array(products) is not fetched and/or the values are not properly assigned.
How can I now parse the StringList into my local model properly? Does anyone know the exact syntax?
edit:
If I assign record["products"] to a variable, the value is 'nil'.
And here is the output from the debugger. It seems as if only the key "name" will be found... No trace of "products"
Printing description of success._valueStore:
(CKRecordValueStore?) _valueStore = 0x00006000009ade60 {
baseNSObject@0 = {
isa = CKRecordValueStore
}
_trackChanges = '\x01'
_values = 0x00006000006148e0 1 key/value pair {
[0] = {
key = "name"
value = "John Doe"
}
}
