This adds a Preferences object to the app, which is exposed to all SwiftUI views via:
@EnvironmentObject var preferences: Preferences
This object makes it trivial (one-line declaration) to define a value that gets saved into UserDefaults. Since it's an ObservableObject, it can be used for bindings into UI elements, replacing the previous combination of @State + onChange bindings.
This change also adds a couple of new persisted states:
the state of the "show only booted simulators" toggle
This adds a
Preferences
object to the app, which is exposed to all SwiftUI views via:This object makes it trivial (one-line declaration) to define a value that gets saved into
UserDefaults
. Since it's anObservableObject
, it can be used for bindings into UI elements, replacing the previous combination of@State
+onChange
bindings.This change also adds a couple of new persisted states: