File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,35 +15,24 @@ struct AppSettings<T>: DynamicProperty where T: Equatable {
1515
1616 let keyPath : WritableKeyPath < SettingsData , T >
1717
18- @available ( * ,
19- deprecated,
20- message: """
21- Use init(_ keyPath:) instead, otherwise the view will be reevaluated on every settings change.
22- """
23- )
24- init ( ) where T == SettingsData {
25- self . keyPath = \. self
26- self . settings = . init( \. settings)
27- }
28-
2918 init ( _ keyPath: WritableKeyPath < SettingsData , T > ) {
3019 self . keyPath = keyPath
31- let newKeyPath = ( \EnvironmentValues . settings) . appending ( path: keyPath)
32- self . settings = . init ( newKeyPath )
20+ let settingsKeyPath = ( \EnvironmentValues . settings) . appending ( path: keyPath)
21+ self . settings = Environment ( settingsKeyPath )
3322 }
3423
3524 var wrappedValue : T {
3625 get {
37- settings . wrappedValue
26+ Settings . shared . preferences [ keyPath : keyPath ]
3827 }
3928 nonmutating set {
4029 Settings . shared. preferences [ keyPath: keyPath] = newValue
4130 }
4231 }
4332
4433 var projectedValue : Binding < T > {
45- . init {
46- settings . wrappedValue
34+ Binding {
35+ Settings . shared . preferences [ keyPath : keyPath ]
4736 } set: {
4837 Settings . shared. preferences [ keyPath: keyPath] = $0
4938 }
Original file line number Diff line number Diff line change @@ -47,20 +47,20 @@ struct ViewCommands: Commands {
4747
4848 Menu ( " Font Size " ) {
4949 Button ( " Increase " ) {
50- if ! ( editorFontSize >= 288 ) {
50+ if editorFontSize < 288 {
5151 editorFontSize += 1
5252 }
53- if ! ( terminalFontSize >= 288 ) {
53+ if terminalFontSize < 288 {
5454 terminalFontSize += 1
5555 }
5656 }
5757 . keyboardShortcut ( " + " )
5858
5959 Button ( " Decrease " ) {
60- if ! ( editorFontSize <= 1 ) {
60+ if editorFontSize > 1 {
6161 editorFontSize -= 1
6262 }
63- if ! ( terminalFontSize <= 1 ) {
63+ if terminalFontSize > 1 {
6464 terminalFontSize -= 1
6565 }
6666 }
You can’t perform that action at this time.
0 commit comments