SwiftUIでのサイドバー
#Swift
#SwiftUI
#Xcode
macOSでサイドバーの表示を切り替える
.toolbarでツールバーにボタンを配置した上でアクションを設定する:
code:Swift
func toggleSidebar() {
#if
os(macOS)
NSApp.keyWindow?.firstResponder?.tryToPerform(#selector(NSSplitViewController.toggleSidebar(_:)), with: nil)
#endif
}