SwiftUI Splitview: persist view positions

I am creating a SwiftUI 2 app with a HSplitView. The SplitView has several subviews (sidebar - main view - detail view).

The user may resize the individual views with the normal split view behavior (dragging the divider bar).

I want to persist the user's last used view sizes, so that when the user closes the app and comes back later, the same view layout (view sizes inside the splitview) is presented.

How can/should this be achieved?

Thanks for your help.


Accepted Reply

Update: working in Big Sur beta 9, XCode12.2 beta 2.
  • I can't get this to work, would you be so kind to share your solution? Thanks!

    Fabio
Add a Comment

Replies

Update: working in Big Sur beta 9, XCode12.2 beta 2.
  • I can't get this to work, would you be so kind to share your solution? Thanks!

    Fabio
Add a Comment