younger_times
2023-08-15 2ebbafa4b4a2994ae979fed38e1266d9efd5657e
BrokerDriver/Home/VC/HomeVC.swift
@@ -8,6 +8,7 @@
import UIKit
import FFPage
import SPPageMenu
import CoreLocation
class HomeVC: BaseViewController {
@@ -39,9 +40,19 @@
        return vc
    }()
   private lazy var manager:CLLocationManager = {
      let mana = CLLocationManager()
      mana.delegate = self
      mana.requestAlwaysAuthorization()
      mana.distanceFilter = 20
      mana.desiredAccuracy = 10
      return mana
   }()
    override func viewDidLoad() {
        super.viewDidLoad()
      manager.startUpdatingLocation()
    }
@@ -103,3 +114,17 @@
    }
}
extension HomeVC:CLLocationManagerDelegate{
   func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
   }
   func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
      if let location = locations.last{
         Services.uploadLocation(coordinate: location.coordinate).subscribe(onNext: {data in
         }).disposed(by: disposeBag)
      }
   }
}