From f01025aa3ca689f8a03cf9a74aebb21a07bd1b3d Mon Sep 17 00:00:00 2001 From: Abhishek Banthia <8280282+n0shake@users.noreply.github.com> Date: Fri, 15 Apr 2022 21:11:42 -0400 Subject: [PATCH] Inject store in LocationController. --- Clocker/Clocker/LocationController.swift | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Clocker/Clocker/LocationController.swift b/Clocker/Clocker/LocationController.swift index 5b9dba3..c635e26 100644 --- a/Clocker/Clocker/LocationController.swift +++ b/Clocker/Clocker/LocationController.swift @@ -6,7 +6,12 @@ import CoreLoggerKit import CoreModelKit class LocationController: NSObject { - public static let sharedInstance = LocationController() + private let store: DataStore + + init(withStore dataStore: DataStore) { + store = dataStore + super.init() + } private var locationManager: CLLocationManager = { let locationManager = CLLocationManager() @@ -14,10 +19,6 @@ class LocationController: NSObject { return locationManager }() - class func sharedController() -> LocationController { - return sharedInstance - } - func authorizationStatus() -> CLAuthorizationStatus { return CLLocationManager.authorizationStatus() } @@ -58,7 +59,7 @@ class LocationController: NSObject { } private func updateHomeObject(with customLabel: String, coordinates: CLLocationCoordinate2D?) { - let timezones = DataStore.shared().timezones() + let timezones = store.timezones() var timezoneObjects: [TimezoneData] = [] @@ -83,7 +84,7 @@ class LocationController: NSObject { datas.append(dataObject) } - DataStore.shared().setTimezones(datas) + store.setTimezones(datas) } }