Contemplating CloudKit, ought to tags
array be elective?
@Mannequin
last class Merchandise {
let title: String = ""
let subtitle: String = ""
@Relationship(deleteRule: .cascade, inverse: TagModel.merchandise)
let tags: [TagModel] = []?
}
Or an empty array is ample?
@Mannequin
last class Merchandise {
let title: String = ""
let subtitle: String = ""
@Relationship(deleteRule: .cascade, inverse: TagModel.merchandise)
let tags: [TagModel] = []
}
I perceive that relationships should be elective, as CloudKit syncs information non-atomically. So our code ought to anticipate some relations not at all times obtainable. But I am unsure about arrays (to-many relationships). It appears that evidently simply by utilizing an array that may be empty, we’re already anticipating some relations not at all times obtainable.
How did you implement to-many SwiftData relationships contemplating CloudKit?