It seems that LPMetadataProvider can only be used on the main thread. This doesn't seem to be documented anywhere!
So, the fix is:
Task { @MainActor
guard let properties = await page.properties(),
...
Further to this. It appears that the error "[error] CoreData: Metadata Inconsistency: Missing metadata for record:" leads to these duplication errors. Perhaps this relates to a Share Extension being killed part way through the sync process? How can I avoid this issue?
Thank you for your answer. I was expecting the sidebar to sit below the tab bar, alongside the detail view. Is there a way to do this on Sonoma? The current behaviour is very strange - it takes two button clicks to return to the Types tab, which then shifts the whole layout. When on the General tab the tab bar remains full width.
After some research I went with the first option, but half-hiding properties behind transient versions. This makes it clear when something is going to be modified.
Unfortunately I can't change the post title at this point - which was based on my previous experience with Core Data.
ModelContext.willSave is sent rarely on macOS - for example when the app moves into the background. Changes to many models can happen between notifications. Using the willSave approach would cause issues with undo etc.
private(set) var text: String = ""
var textModify: String {
get { text }
set {
text = newValue
modified = Date.now
} }
I have found that the predicate building for a many-many relationship works in the following form:
let itemsIDs = day.show?.map { $0.persistentModelID } ?? []
let predicate = #Predicate<Item> { item in itemsIDs.contains(item.persistentModelID) }
It seems that LPMetadataProvider can only be used on the main thread. This doesn't seem to be documented anywhere!
So, the fix is:
Task { @MainActor
guard let properties = await page.properties(),
...
Further to this. It appears that the error "[error] CoreData: Metadata Inconsistency: Missing metadata for record:" leads to these duplication errors. Perhaps this relates to a Share Extension being killed part way through the sync process? How can I avoid this issue?
Thank you for your answer. I was expecting the sidebar to sit below the tab bar, alongside the detail view. Is there a way to do this on Sonoma? The current behaviour is very strange - it takes two button clicks to return to the Types tab, which then shifts the whole layout. When on the General tab the tab bar remains full width.
After some research I went with the first option, but half-hiding properties behind transient versions. This makes it clear when something is going to be modified.
Unfortunately I can't change the post title at this point - which was based on my previous experience with Core Data.
ModelContext.willSave is sent rarely on macOS - for example when the app moves into the background. Changes to many models can happen between notifications. Using the willSave approach would cause issues with undo etc.
private(set) var text: String = ""
var textModify: String {
get { text }
set {
text = newValue
modified = Date.now
} }
I have found that the predicate building for a many-many relationship works in the following form:
let itemsIDs = day.show?.map { $0.persistentModelID } ?? []
let predicate = #Predicate<Item> { item in itemsIDs.contains(item.persistentModelID) }