Post

Replies

Boosts

Views

Activity

Collapse sidebar in SwiftUI (Xcode 12)
I'm trying to do a simple application in SwiftUI taking advantage of SwiftUI 2.0's new multiplatform project template, and I wish to add the option to collapse the sidebar as many other apps do. I've got an extremely simple sidebar I did following the Fruta example project, and I tried adding a boolean state variable that controls whether the sidebar should show or not, but that doesn't work because when the sidebar is hidden, the main view is turned translucent. On iPadOS, a button appears on top of the sidebar that allows to collapse it. How would I do this in macOS? Is there a way to natively achieve this in SwiftUI, or I'll need to resort to a UIKit workaround?  Please note I'm using macOS Big Sur, Xcode 12, and SwiftUI 2.0 Thanks in advance.
11
0
9.1k
Jun ’20