File tree Expand file tree Collapse file tree 4 files changed +5
-12
lines changed
Expand file tree Collapse file tree 4 files changed +5
-12
lines changed Original file line number Diff line number Diff line change 88import CoreLocation
99import Foundation
1010
11- class LocationManagerDelegate : NSObject , ObservableObject , CLLocationManagerDelegate {
11+ class LocationManagerDelegate : NSObject , CLLocationManagerDelegate {
1212 private var locationManager = CLLocationManager ( )
13- @ Published var location : CLLocation ?
13+ private ( set ) var location : CLLocation ?
1414 var locationUpdateHandler : ( ( CLLocationCoordinate2D ) -> Void ) ?
1515 var headingUpdateHandler : ( ( Double ) -> Void ) ?
1616
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ struct InitialView: View {
1111 @StateObject private var viewModel = InitialViewModel ( )
1212 @State private var shouldNavigateToMapView = false
1313 @State private var selectedWorkspace : Workspace ? = nil
14- @StateObject private var locManagerDelegate = LocationManagerDelegate ( )
1514 @AppStorage ( " loggedIn " ) private var loggedIn : Bool = false
1615
1716 var body : some View {
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ struct CustomMap: UIViewRepresentable {
2222 @Binding var shouldShowPolyline : Bool
2323 @Binding var isPresented : Bool
2424 @Binding var isUserSettingsPresented : Bool
25- @ StateObject var locationManagerDelegate = LocationManagerDelegate ( )
25+ var locationManagerDelegate = LocationManagerDelegate ( )
2626
2727 @Binding var selectedAnnotations : Set < DisplayUnitAnnotation >
2828 @Binding var isMultiSelectModeEnabled : Bool
@@ -554,7 +554,7 @@ struct CustomMap: UIViewRepresentable {
554554
555555
556556 // calculate distance between user current location and selected annotation
557- func calculateDistance( selectedAnnotation: CLLocationCoordinate2D ) -> CLLocationDistance {
557+ private func calculateDistance( selectedAnnotation: CLLocationCoordinate2D ) -> CLLocationDistance {
558558 guard let userCurrentLocation = locationManagerDelegate. location? . coordinate else { return CLLocationDistance ( 0 ) }
559559
560560 let fromLocation = CLLocation ( latitude: userCurrentLocation. latitude, longitude: userCurrentLocation. longitude)
@@ -563,7 +563,7 @@ struct CustomMap: UIViewRepresentable {
563563 }
564564
565565 // infer direction
566- func inferDirection( selectedAnnotation: CLLocationCoordinate2D ) -> String {
566+ private func inferDirection( selectedAnnotation: CLLocationCoordinate2D ) -> String {
567567 guard let userCurrentLocation = locationManagerDelegate. location? . coordinate else { return " undetermined " }
568568 let userLocationPoint = MKMapPoint ( userCurrentLocation)
569569 let destinationPoint = MKMapPoint ( selectedAnnotation)
Original file line number Diff line number Diff line change @@ -110,12 +110,6 @@ class MapViewModel: ObservableObject {
110110 }
111111 }
112112
113- @objc private func locationDidChange( ) {
114- guard let userLocation = locationManagerDelegate. location else { return }
115- // fetchOSMDataFor(currentLocation: userLocation.coordinate)
116- fetchOSMDataFor ( from: . currentLocation( location: userLocation. coordinate) )
117- }
118-
119113 func fetchOSMDataFor( from bboxSource: BBoxSource ) {
120114 if isLoading {
121115 return
You can’t perform that action at this time.
0 commit comments