import SwiftUI struct ContentView: View { @ObservedObject var state: AppState @State private var sidebarVisible: Bool = true var body: some View { HSplitView { if sidebarVisible { SidebarView(state: state) .frame(minWidth: 180, idealWidth: 250, maxWidth: 350) } EditorView(state: state) .frame(minWidth: 400) } .frame(minWidth: 700, minHeight: 400) .background(Color(ns: Theme.current.base)) .onReceive(NotificationCenter.default.publisher(for: .toggleSidebar)) { _ in withAnimation { sidebarVisible.toggle() } } } } extension Notification.Name { static let toggleSidebar = Notification.Name("toggleSidebar") }