| | |
| | | import UIKit |
| | | import FFPage |
| | | import SPPageMenu |
| | | import CoreLocation |
| | | |
| | | class HomeVC: BaseViewController { |
| | | |
| | |
| | | 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() |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | 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) |
| | | } |
| | | } |
| | | } |