@@ -13,22 +13,24 @@ final class Settings: ObservableObject {
1313 var suggestionPresentationModeRawValue : Int = 0
1414 @AppStorage ( SettingsKey . automaticallyCheckForUpdate, store: . shared)
1515 var automaticallyCheckForUpdate : Bool = false
16+ @AppStorage ( SettingsKey . suggestionWidgetPositionMode, store: . shared)
17+ var suggestionWidgetPositionModeRawValue : Int = 0
1618 init ( ) { }
1719}
1820
1921struct SettingsView : View {
2022 @StateObject var settings = Settings ( )
2123 @State var editingRealtimeSuggestionDebounce : Double = UserDefaults . shared
2224 . value ( forKey: SettingsKey . realtimeSuggestionDebounce) as? Double ?? 0.7
23-
25+
2426 var body : some View {
2527 Section {
2628 Form {
2729 Toggle ( isOn: $settings. quitXPCServiceOnXcodeAndAppQuit) {
2830 Text ( " Quit service when Xcode and host app are terminated " )
2931 }
3032 . toggleStyle ( . switch)
31-
33+
3234 Toggle ( isOn: $settings. automaticallyCheckForUpdate) {
3335 Text ( " Automatically Check for Update " )
3436 }
@@ -47,6 +49,23 @@ struct SettingsView: View {
4749 Text ( " Present suggestions in " )
4850 }
4951
52+ if settings. suggestionPresentationModeRawValue == PresentationMode . floatingWidget
53+ . rawValue
54+ {
55+ Picker ( selection: $settings. suggestionWidgetPositionModeRawValue) {
56+ ForEach ( SuggestionWidgetPositionMode . allCases, id: \. rawValue) {
57+ switch $0 {
58+ case . fixedToBottom:
59+ Text ( " Fixed to Bottom " )
60+ case . alignToTextCursor:
61+ Text ( " Follow Text Cursor " )
62+ }
63+ }
64+ } label: {
65+ Text ( " Widget position " )
66+ }
67+ }
68+
5069 Toggle ( isOn: $settings. realtimeSuggestionToggle) {
5170 Text ( " Real-time suggestion " )
5271 }
0 commit comments