Untitled
unknown
swift
3 years ago
2.5 kB
7
Indexable
//
// Garageworks_iOS_RevampApp.swift
// Garageworks-iOS-Revamp
//
// Created by mac on 20/09/22.
//
import SwiftUI
import GoogleMaps
import GooglePlaces
import netfox
final class AppDelegate: NSObject, UIApplicationDelegate, CLLocationManagerDelegate {
var locationManager = CLLocationManager()
var didChangeLocationAuthorizationStatus: ((_ status: CLAuthorizationStatus) -> Void)?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
GMSServices.provideAPIKey("AIzaSyCrtRXcAGKqtztEu6ubTFHx01n7wHfSgLM")
GMSPlacesClient.provideAPIKey("AIzaSyBgW3kze70q1ov1DO0DMUDsZd3f8CUUOBw")
NFX.sharedInstance().start()
initLocationManager()
print(" Current Latitide: \(locationManager.location?.coordinate.latitude),Current Longitude\(locationManager.location?.coordinate.longitude)")
UserDefaultsManager.storeCurrentLat(value: (locationManager.location?.coordinate.latitude ?? 18.5195))
UserDefaultsManager.storeCurrentLong(value: (locationManager.location?.coordinate.longitude ?? 73.8553))
return true
}
// Location Manager helper stuff
func initLocationManager() {
locationManager = CLLocationManager()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.requestAlwaysAuthorization()
}
//Location Manager Delegate stuff
//If failed
private func locationManager(manager: CLLocationManager!, didFailWithError error: NSError!) {
locationManager.stopUpdatingLocation()
if ((error) != nil) {
print(error.localizedDescription ?? "")
}
}
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
locationManager = manager
}
// authorization status
private func locationManager(manager: CLLocationManager!,
didChangeAuthorizationStatus status: CLAuthorizationStatus) {
didChangeLocationAuthorizationStatus?(status)
}
}
@main
struct Garageworks_iOS_RevampApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
var body: some Scene {
WindowGroup {
SplashView()
//DocumentVaultView()
}
}
}
Editor is loading...