How is Safari's sidebar animation implemented in visionOS?

When tapping the sidebar button, the window expands in the leading edge to accommodate the sidebar, and shrinks when closed.

Can this be achieved with public APIs on UISplitView or NavigationSplitView?

Add a Comment

Replies

There is an example of this for UIKit here: https://github.com/steventroughtonsmith/VisionExpandingSidebar/tree/main

Looks like it uses a new UIScene preferences type for VisionOS.

https://developer.apple.com/documentation/uikit/uiwindowscene/geometrypreferences/reality

However, I'm unable to find a declarative analog to this with SwiftUI. You can set the max and min sizes, but it's unclear how to request preferred size for the window, as you can with the size property.