diff --git a/Sources/ApplicationKit/LocationApplication/LocationApplication.swift b/Sources/ApplicationKit/LocationApplication/LocationApplication.swift index 42ce024..f8c574c 100644 --- a/Sources/ApplicationKit/LocationApplication/LocationApplication.swift +++ b/Sources/ApplicationKit/LocationApplication/LocationApplication.swift @@ -18,20 +18,25 @@ open class LocationApplication: LifecyleApplication, CLLocationManagerDelegate { // MARK: - Open CLLocationManagerDelegate Functions + #if os(iOS) || os(macOS) open func locationManager(_ manager: CLLocationManager, didVisit visit: CLVisit) { } open func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) { } open func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) { } - open func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading) { } - open func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { } - open func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { } open func locationManager(_ manager: CLLocationManager, didRange beacons: [CLBeacon], satisfying beaconConstraint: CLBeaconIdentityConstraint) { } open func locationManager(_ manager: CLLocationManager, didStartMonitoringFor region: CLRegion) { } open func locationManager(_ manager: CLLocationManager, didDetermineState state: CLRegionState, for region: CLRegion) { } open func locationManager(_ manager: CLLocationManager, didFailRangingFor beaconConstraint: CLBeaconIdentityConstraint, error: Error) { } open func locationManager(_ manager: CLLocationManager, didFinishDeferredUpdatesWithError error: Error?) { } open func locationManager(_ manager: CLLocationManager, monitoringDidFailFor region: CLRegion?, withError error: Error) { } - open func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) { } open func locationManagerDidPauseLocationUpdates(_ manager: CLLocationManager) { } open func locationManagerDidResumeLocationUpdates(_ manager: CLLocationManager) { } + #endif + + #if !os(tvOS) open func locationManagerShouldDisplayHeadingCalibration(_ manager: CLLocationManager) -> Bool { false } + #endif + + open func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { } + open func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { } + open func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) { } } diff --git a/Tests/ApplicationKitTests/LocationApplicationTests.swift b/Tests/ApplicationKitTests/LocationApplicationTests.swift index 778fe0c..084c5fc 100644 --- a/Tests/ApplicationKitTests/LocationApplicationTests.swift +++ b/Tests/ApplicationKitTests/LocationApplicationTests.swift @@ -4,15 +4,11 @@ import CoreLocation @testable import ApplicationKit class MockLocationManager: LocationManager { - func test() { - delegate?.locationManager?(.init(), didEnterRegion: .init()) - } + } class MyLocationApplication: LocationApplication { - override func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) { - print("didEnterRegion: \(region)") - } + } final class LocationApplicationTests: XCTestCase { @@ -32,8 +28,6 @@ final class LocationApplicationTests: XCTestCase { XCTAssertNotNil(locationManager.delegate) XCTAssertTrue(locationManager.delegate is MyLocationApplication) - mockLocationManager?.test() - locationManagerOverride.cancel() XCTAssertNotNil(locationManager.delegate)