Post

Replies

Boosts

Views

Activity

Reply to SwiftData: This model instance was invalidated because its backing data could no longer be found the store
Hello @joadan, I made the sample as is to illustrate that may be the user will touch the mainContext to delete objects (by touching a user interface) even if a ModelActor exists. But may be that’s another topic. I update my sample and just tried using modelContext in delete and removing @MainActor but as you guess, still crashing. However manually clearing the self._rooms property (~= deleteV1) or even setting explicitly nil the home property of my rooms before deleting, avoid the crash. When you say « you have a reference to the deleted objects in self._rooms that you need to clear before doing the delete. » This seems to be obvious to you can you detail a bit ? I guess this is pretty common scenario where an object like a view retain some models. Why does keeping a reference to homes is ok, rooms ok but both leads to a crash?
2w
Reply to [TextKit2] - Wrong document height sometimes ?
"Are you using the system-provided NSTextView, or are you writing your own custom text view using TextKit2?" I've tested both during my investigation: Custom text view - inherits NSView & using TextKit2: I'm able to reproduce the issue mentioned above (Xcode 16.4 - macOS 15.6) Custom text view - inherits NSTextView & using TextKit2: I'm able to reproduce the issue mentioned above (Xcode 16.4 - macOS 15.6) System-provided NSTextView: OK (Xcode 16.4 - macOS 15.6) It really seems to be because of what value is returned by : enumerateTextLayoutFragments(from: documentRange.endLocation, options: [.reverse, .ensuresLayout]) { layoutFragment in ... layoutFragment.layoutFragmentFrame.maxY ... } "For your own custom text view, you should be able to fix the issue by adjusting the viewport. This post provides a code snippet for that purpose. Please see if that helps." Yes indeed, I read this post and I can make a "workaround" with (OR without adjusting the viewport by ensuring a layout at appropriate time during scroll). That's why I thought it is may be intended to be that way. "The sample app you mentioned is intended to demonstrate a text rendering view with TextKit2. It is a bug that the app presents the issue, and so please file a feedback report, if you don't mind." Will do. Thanks for your quick feedback very much appreciated!
Topic: UI Frameworks SubTopic: AppKit Tags:
Aug ’25