vChewing-macOS/Packages/vChewing_MainAssembly/Sources/MainAssembly/SettingsUI/VwrSettingsUI.swift

59 lines
2.1 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// (c) 2021 and onwards The vChewing Project (MIT-NTL License).
// ====================
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
// ... with NTL restriction stating that:
// No trademark license is granted to use the trade names, trademarks, service
// marks, or product names of Contributor, except as required to fulfill notice
// requirements defined in MIT License.
import SwiftUI
@available(macOS 13, *)
public struct VwrSettingsUI: View {
@State private var selectedTabID: PrefUITabs?
public init() {}
/// macOS 13 使 NavigationSplitView
/// NSHostingView
/// NavigationView
public var body: some View {
NavigationView {
VStack {
List(PrefUITabs.allCases, selection: $selectedTabID) { neta in
if neta == PrefUITabs.tabGeneral {
if let appIcon = NSImage(named: "IconSansMargin") {
Image(nsImage: appIcon).resizable()
.frame(width: 86, height: 86)
.frame(maxWidth: .infinity, alignment: .leading)
.padding([.top, .bottom], NSFont.systemFontSize / 2)
}
}
NavigationLink(destination: neta.suiView) {
Label {
Text(verbatim: neta.i18nTitle)
} icon: {
Image(nsImage: neta.icon)
}
}
}
Spacer()
VStack(alignment: .leading) {
Text("v" + IMEApp.appMainVersionLabel.joined(separator: " Build "))
Text(IMEApp.appSignedDateLabel)
}.settingsDescription().padding()
}
.navigationTitle(PrefUITabs.tabGeneral.i18nTitle)
.frame(minWidth: 128, idealWidth: 128, maxWidth: 128)
PrefUITabs.tabGeneral.suiView
}
.frame(width: CtlSettingsUI.formWidth + 140, height: CtlSettingsUI.contentMaxHeight)
}
}
@available(macOS 13, *)
struct VwrSettingsUI_Previews: PreviewProvider {
static var previews: some View {
VwrSettingsUI()
}
}