Post

Replies

Boosts

Views

Activity

Reply to What is the best SwiftData approach to replicate NSManagedObject's willSave?
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 } }
Oct ’24
Reply to NavigationSplitView TabView Toolbar Clash
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.
Jul ’24