forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPromptToCodeSettingsView.swift
More file actions
68 lines (57 loc) · 2.17 KB
/
PromptToCodeSettingsView.swift
File metadata and controls
68 lines (57 loc) · 2.17 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
import SwiftUI
struct PromptToCodeSettingsView: View {
final class Settings: ObservableObject {
@AppStorage(\.hideCommonPrecedingSpacesInSuggestion)
var hideCommonPrecedingSpacesInSuggestion
@AppStorage(\.suggestionCodeFontSize)
var suggestionCodeFontSize
@AppStorage(\.promptToCodeGenerateDescription)
var promptToCodeGenerateDescription
@AppStorage(\.promptToCodeGenerateDescriptionInUserPreferredLanguage)
var promptToCodeGenerateDescriptionInUserPreferredLanguage
init() {}
}
@StateObject var settings = Settings()
var body: some View {
VStack(alignment: .center) {
Form {
Toggle(isOn: $settings.promptToCodeGenerateDescription) {
Text("Generate Description")
}
Toggle(isOn: $settings.promptToCodeGenerateDescriptionInUserPreferredLanguage) {
Text("Generate Description in user preferred language")
}
}
Divider()
Text("Mirroring Settings of Suggestion Feature")
.foregroundColor(.white)
.padding(.vertical, 2)
.padding(.horizontal, 8)
.background(
Color.accentColor,
in: RoundedRectangle(cornerRadius: 20)
)
Form {
Toggle(isOn: $settings.hideCommonPrecedingSpacesInSuggestion) {
Text("Hide Common Preceding Spaces")
}.disabled(true)
HStack {
TextField(text: .init(get: {
"\(Int(settings.suggestionCodeFontSize))"
}, set: {
settings.suggestionCodeFontSize = Double(Int($0) ?? 0)
})) {
Text("Font size of suggestion code")
}
.textFieldStyle(.roundedBorder)
Text("pt")
}.disabled(true)
}
}
}
}
struct PromptToCodeSettingsView_Previews: PreviewProvider {
static var previews: some View {
PromptToCodeSettingsView()
}
}