// // SettingsView.swift // punchnet // // Created by 安礼成 on 2026/1/16. // import SwiftUI struct SettingsView: View { @State private var state = SettingsState() @State private var hovering = false var body: some View { NavigationSplitView { List(SettingsState.MenuItem.allCases, id: \.self) { menu in HStack(alignment: .center) { Rectangle() .frame(width: 3, height: 25) .foregroundColor(self.state.currentMeun == menu ? .black : .clear) Text(menu.rawValue) Spacer() } .contentShape(Rectangle()) .onTapGesture { self.state.currentMeun = menu } .onHover { inside in hovering = inside if inside { NSCursor.pointingHand.push() } else { NSCursor.pop() } } } .listStyle(.sidebar) .border(Color.red) } detail: { VStack(alignment: .leading, spacing: 0) { switch self.state.currentMeun { case .accout: SettingsAccountView(state: self.state) case .network: SettingsNetworkView(state: self.state) case .device: SettingsDeviceView() case .system: SettingsSystemView() case .about: SettingsAboutView() } Spacer() } .padding() .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) } } } #Preview { SettingsView() }