Skip to content

Commit aec0029

Browse files
committed
removed LocationManagerDelegate as ObservableObject as not found the use.
1 parent 9df417f commit aec0029

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

GoInfoGame/GoInfoGame/LocationManagerDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import CoreLocation
99
import 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

GoInfoGame/GoInfoGame/UI/InitialView/InitialView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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 {

GoInfoGame/GoInfoGame/UI/Map/CustomMap.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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)

GoInfoGame/GoInfoGame/UI/Map/MapViewModel.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)