If you are using location based values in all the screen of apps then its a better to implement as a singleton class.First import the core location.The class will be as follows. Code: import UIKit import CoreLocation protocol LocationServiceDelegate { func tracingLocation(currentLocation: CLLocation ) func tracingLocationDidFailWithError(error: NSError ) } class LocationSingleton: NSObject , CLLocationManagerDelegate { var locationManager: CLLocationManager ? var lastLocation: CLLocation ? var delegate: LocationServiceDelegate ? static let sharedInstance: LocationSingleton = { let instance = LocationSingleton () return instance }() override init () { super . init () self . lo...
Comments
Post a Comment