hi Richard,
i'll answer this from the Core Data perspective, where a list is driven with a @FetchRequest. from all that i've read, it should work the same with SwiftData, where a list is driven by @Query.
my simple answer is: do nothing. in your "Add New Object view", the outcomes are:
Cancel = dismiss and do nothing.
Save = Create and save a new object to Core Data (SwiftData) and then dismiss. but do nothing else! the @FetchRequest (@Query) in your list view will pick up that a new object has been added, and redraw the list.
if your list view wanted to use what was the new object created in your list view, then i would have the "Add New Object view" take a closure as a parameter with signature (NewObject) -> Void that is defined in your list view, and have the save routine invoke that closure.
hope that helps,
DMG
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: