This repository was archived by the owner on Jul 1, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsView.swift
More file actions
76 lines (66 loc) · 2.45 KB
/
Copy pathSettingsView.swift
File metadata and controls
76 lines (66 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import SwiftUI
enum AppAccentColor: String, CaseIterable, Identifiable {
case red, green, purple, azure
var id: String { self.rawValue }
var color: Color {
switch self {
case .red: return .red
case .green: return .green
case .purple: return .purple
case .azure: return .cyan
}
}
var title: LocalizedStringKey {
switch self {
case .red: return "Red"
case .green: return "Green"
case .purple: return "Purple"
case .azure: return "Azure"
}
}
}
struct SettingsView: View {
@AppStorage("app_theme") private var appTheme = "system"
@AppStorage("app_language") private var appLanguage = "en"
@AppStorage("app_accent_color") private var appAccentColor = "azure"
@Environment(\.dismiss) private var dismiss
var body: some View {
VStack(spacing: 0) {
HStack {
Text("Settings").font(.headline)
Spacer()
Button("Done") { dismiss() }.keyboardShortcut(.return)
}
.padding()
.background(.ultraThinMaterial)
Form {
Section(header: Text("Appearance")) {
Picker("Theme", selection: $appTheme) {
Text("System").tag("system")
Text("Light").tag("light")
Text("Dark").tag("dark")
}.pickerStyle(.radioGroup)
Divider()
Picker("Accent Color", selection: $appAccentColor) {
ForEach(AppAccentColor.allCases) { accent in
HStack {
Circle().fill(accent.color).frame(width: 8, height: 8)
Text(accent.title)
}.tag(accent.rawValue)
}
}
}
Section(header: Text("Language")) {
Picker("Interface Language", selection: $appLanguage) {
Text("English").tag("en")
Text("Russian").tag("ru")
Text("German").tag("de")
Text("Chinese").tag("zh-Hans")
}
}
}
.formStyle(.grouped)
}
.frame(width: 400, height: 400)
}
}