import SwiftUI struct SectionedSettingsView: View { @State private var selectedSection: SettingsSection? = .generation var body: some View { NavigationSplitView { SettingsSidebar(selectedSection: $selectedSection) .frame(minWidth: 200, idealWidth: 200, maxWidth: 200) } detail: { DetailView(section: selectedSection) } } } struct DetailView: View { let section: SettingsSection? var body: some View { Group { switch section { case .generation: GenerationSettingsView() case .folders: FolderSettingsView() case .navigationBar: NavigationBarSettingsView() case .postFeed: PostFeedSettingsView() case .none: Text("Select a setting from the sidebar") .foregroundStyle(.secondary) } } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) .padding() .navigationTitle(section?.rawValue ?? "") } } struct AppearanceView: View { var body: some View { VStack(alignment: .leading) { Text("Appearance Settings") .font(.largeTitle) .bold() Text("Customize the look and feel of the app.") } } } struct NotificationsView: View { var body: some View { VStack(alignment: .leading) { Text("Notifications Settings") .font(.largeTitle) .bold() Text("Manage your notification preferences.") } } } struct PrivacyView: View { var body: some View { VStack(alignment: .leading) { Text("Privacy Settings") .font(.largeTitle) .bold() Text("Configure your privacy and security settings.") } } } #Preview { SectionedSettingsView() }