I'm honestly lost on the automatic inverse relationships. I've reviewed the SampleTrips project and followed what they do there and it doesn't work.
From what I can see, you don't need to do anything other than mark the inverse and then:
let item = BucketListItem(
title: "A bucket list item title",
details: "Details of my bucket list item",
hasReservation: true, isInPlan: true)
item.trip = .preview
but when I review the code of the project in the section where they add bucket list items, they do set the inverse?
private func addItem() {
withAnimation {
let newItem = BucketListItem(title: title, details: details, hasReservation: hasReservations, isInPlan: isInPlan)
modelContext.insert(newItem)
newItem.trip = trip
trip.bucketList.append(newItem)
}
}
this doesn't seem to make sense to me?
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: