diff --git a/Anyway/ViewController.swift b/Anyway/ViewController.swift index 4e8f9f5..947c9f2 100644 --- a/Anyway/ViewController.swift +++ b/Anyway/ViewController.swift @@ -93,10 +93,8 @@ class ViewController: UIViewController, CLLocationManagerDelegate { } } - @IBAction func centerMyLocationButtonClicked(_ sender: Any) { - map.setUserTrackingMode(MKUserTrackingMode.follow, animated: true) - } - + + override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) } @@ -118,6 +116,12 @@ class ViewController: UIViewController, CLLocationManagerDelegate { //MARK: - Logic + @IBAction func centerMyLocationButtonClicked(_ sender: Any) { + if isLocationMonitoringAuthorized() { + map.moveAndZoom(to: map.userLocation.coordinate) + } + } + var isMapCloseEnoughToFetchData: Bool { return btnFilter.isEnabled }