ViewModel
final class ViewModel : NSObject, CLLocationManagerDelegate, Sendable
Undocumented
-
Undocumented
Declaration
Swift
var initialized: Bool { get set }
-
Undocumented
Declaration
Swift
var gauges: [Gauge] { get set }
-
Undocumented
Declaration
Swift
var requestStatus: RequestStatus { get set }
-
Undocumented
Declaration
Swift
var sheetSelectedDetent: GaugeSearchSheetDedents { get set }
-
Undocumented
Declaration
Swift
var userLocation: CLLocation? { get set }
-
Bool value that indicates if location permission granted.
Todo
this is redundant with thelocationPermissionGranted
property. Refactor.Declaration
Swift
var locationDisabled: Bool { get set }
-
Undocumented
Declaration
Swift
var country: CountryValue { get set }
-
Undocumented
Declaration
Swift
var locationTask: Task<(), Never>? { get set }
-
default posisiton of the map is a zoomed out view of the United States
Declaration
Swift
var position: MapCameraPosition { get set }
-
Bool value that indicates if location permission granted.
Todo
this is redundant with thelocationDisabled
property and doesn’t work as expected. Refactor.Declaration
Swift
var locationPermissionGranted: Bool { get }
-
The search parameters for the view model. When the search parameters are set, the view model will update the map and fetch gauges based on the search parameters.
Declaration
Swift
var searchParams: SearchParams { get set }
-
The current state value. When the current state value is set, the view model will fetch gauges based on the state. This can be overridden by changes to the search parameters.
Declaration
Swift
var currentState: StateValue { get set }
-
Sets the initial values of the view model when the map view appears.
Declaration
Swift
func onAppear()
-
Undocumented
Declaration
Swift
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager)
-
When the location manager updates the location, the view model will center the map on the user’s location. If the user location has already been set, this function will return early to avoid re-centering the map.
Declaration
Swift
func locationManager(_: CLLocationManager, didUpdateLocations locations: [CLLocation])
-
When the location manager fails with an error, the view model will log the error.
Declaration
Swift
func locationManager(_: CLLocationManager, didFailWithError error: any Error)
-
- If the user applies a search query, we want to override the map position.
Declaration
Swift
func overrideMapPosition(_ state: StateValue?)
Parameters
state
The state or province to center the map on.
-
Centers the map on the user’s location. If the user has applied a search query, the search query will be cleared.
Declaration
Swift
func centerMapOnUserLocation()
-
Undocumented
See moreDeclaration
Swift
struct SearchParams : Equatable