diff --git a/CodeEdit/Features/Settings/Models/AppSettings.swift b/CodeEdit/Features/Settings/Models/AppSettings.swift index b3d4757e2..d7a115df3 100644 --- a/CodeEdit/Features/Settings/Models/AppSettings.swift +++ b/CodeEdit/Features/Settings/Models/AppSettings.swift @@ -15,26 +15,15 @@ struct AppSettings: DynamicProperty where T: Equatable { let keyPath: WritableKeyPath - @available(*, - deprecated, - message: """ -Use init(_ keyPath:) instead, otherwise the view will be reevaluated on every settings change. -""" - ) - init() where T == SettingsData { - self.keyPath = \.self - self.settings = .init(\.settings) - } - init(_ keyPath: WritableKeyPath) { self.keyPath = keyPath - let newKeyPath = (\EnvironmentValues.settings).appending(path: keyPath) - self.settings = .init(newKeyPath) + let settingsKeyPath = (\EnvironmentValues.settings).appending(path: keyPath) + self.settings = Environment(settingsKeyPath) } var wrappedValue: T { get { - settings.wrappedValue + Settings.shared.preferences[keyPath: keyPath] } nonmutating set { Settings.shared.preferences[keyPath: keyPath] = newValue @@ -42,8 +31,8 @@ Use init(_ keyPath:) instead, otherwise the view will be reevaluated on every se } var projectedValue: Binding { - .init { - settings.wrappedValue + Binding { + Settings.shared.preferences[keyPath: keyPath] } set: { Settings.shared.preferences[keyPath: keyPath] = $0 } diff --git a/CodeEdit/Features/WindowCommands/ViewCommands.swift b/CodeEdit/Features/WindowCommands/ViewCommands.swift index 685c5360e..9c8fb9e46 100644 --- a/CodeEdit/Features/WindowCommands/ViewCommands.swift +++ b/CodeEdit/Features/WindowCommands/ViewCommands.swift @@ -47,20 +47,20 @@ struct ViewCommands: Commands { Menu("Font Size") { Button("Increase") { - if !(editorFontSize >= 288) { + if editorFontSize < 288 { editorFontSize += 1 } - if !(terminalFontSize >= 288) { + if terminalFontSize < 288 { terminalFontSize += 1 } } .keyboardShortcut("+") Button("Decrease") { - if !(editorFontSize <= 1) { + if editorFontSize > 1 { editorFontSize -= 1 } - if !(terminalFontSize <= 1) { + if terminalFontSize > 1 { terminalFontSize -= 1 } }