Thanks for confirming the known issue, @Vision Pro Engineer. I have opened FB14493265.
I appreciate the recommendations on .searchable. You're right, SwiftUI's flexibility on search-field placement is helpful. The trouble is, my search results require nested/hierarchical navigation. Thus, the theoretical need for NavigationStack (paired with NavigationPath) at some level inside or above .searchable, which seems to be quietly forbidden by NavigationSplitView in its parent sidebar view.
Post
Replies
Boosts
Views
Activity
Thank you for the quick reply.
I'm still seeing the buggy behavior on my side. Here are the steps I'm taking:
Open sample project in Xcode 15.4.
Run on simulator for iPad Pro 11-inch (M4) with iOS 17.5.
Use sidebar to select color.
Use detail view to select shape.
Make note of detail view title ("Color + Shape") and presence of "< Shapes" back button in top left of detail view.
Put app into background (e.g., press ⇧⌘H, or use the simulator's Home button).
Wait 2–5 seconds.
Bring app back into foreground.
Note that app detail view's title has changed ("Shapes") and back button is missing.
Let me know if those steps work for you.
I appreciate your advice regarding NavigationSplitView and its (very helpful) automatic adaptation for compact screens. That was actually my first choice. I ran into trouble, however, when trying to add .searchable() with its own NavigationStack to the root-level sidebar section of NavigationSplitView. It seems that NavigationStack isn't something that SwiftUI wants in that part of the NavigationSplitView. Thus, the less-optimal workaround with dynamic rendering based on @Environment(\.horizontalSizeClass).
Before backgrounding the app:
After backgrounding the app: