Skip to content

Commit

Permalink
Remove tca in favor of combine-only approach to core location depende…
Browse files Browse the repository at this point in the history
…ncies
  • Loading branch information
klundberg committed Sep 7, 2023
1 parent 68cb1f3 commit 5da8eaf
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 302 deletions.
90 changes: 0 additions & 90 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,95 +1,5 @@
{
"pins" : [
{
"identity" : "combine-schedulers",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/combine-schedulers",
"state" : {
"revision" : "ec62f32d21584214a4b27c8cee2b2ad70ab2c38a",
"version" : "0.11.0"
}
},
{
"identity" : "swift-case-paths",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"revision" : "fc45e7b2cfece9dd80b5a45e6469ffe67fe67984",
"version" : "0.14.1"
}
},
{
"identity" : "swift-clocks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-clocks",
"state" : {
"revision" : "0fbaebfc013715dab44d715a4d350ba37f297e4d",
"version" : "0.4.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version" : "1.0.4"
}
},
{
"identity" : "swift-composable-architecture",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-composable-architecture",
"state" : {
"revision" : "9f4202ab5b8422aa90f0ed983bf7652c3af7abf0",
"version" : "0.59.0"
}
},
{
"identity" : "swift-concurrency-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-concurrency-extras",
"state" : {
"revision" : "479750bd98fac2e813fffcf2af0728b5b0085795",
"version" : "0.1.1"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "4a87bb75be70c983a9548597e8783236feb3401e",
"version" : "0.11.1"
}
},
{
"identity" : "swift-dependencies",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-dependencies",
"state" : {
"revision" : "16fd42ae04c6e7f74a6a86395d04722c641cccee",
"version" : "0.6.0"
}
},
{
"identity" : "swift-identified-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-identified-collections",
"state" : {
"revision" : "d01446a78fb768adc9a78cbb6df07767c8ccfc29",
"version" : "0.8.0"
}
},
{
"identity" : "swiftui-navigation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swiftui-navigation",
"state" : {
"revision" : "2aa885e719087ee19df251c08a5980ad3e787f12",
"version" : "0.8.0"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
Expand Down
7 changes: 4 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ let package = Package(
],
dependencies: [
.package(
url: "https://github.com/pointfreeco/swift-composable-architecture",
.upToNextMajor(from: "0.43.0"))
url: "https://github.com/pointfreeco/xctest-dynamic-overlay.git",
from: "0.9.0"
),
],
targets: [
.target(
name: "ComposableCoreLocation",
dependencies: [
.product(name: "ComposableArchitecture", package: "swift-composable-architecture")
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
]
),
.testTarget(
Expand Down
36 changes: 18 additions & 18 deletions Sources/ComposableCoreLocation/Failing.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ComposableArchitecture
import Combine
import CoreLocation
import XCTestDynamicOverlay

Expand Down Expand Up @@ -46,9 +46,9 @@ extension LocationManager {
XCTFail("A failing endpoint was accessed: 'LocationManager.authorizationStatus'")
return .notDetermined
},
delegate: { .failing("LocationManager.delegate") },
delegate: { .unimplemented("LocationManager.delegate") },
dismissHeadingCalibrationDisplay: {
.failing("LocationManager.dismissHeadingCalibrationDisplay")
.unimplemented("LocationManager.dismissHeadingCalibrationDisplay")
},
heading: {
XCTFail("A failing endpoint was accessed: 'LocationManager.heading'")
Expand Down Expand Up @@ -78,32 +78,32 @@ extension LocationManager {
XCTFail("A failing endpoint was accessed: 'LocationManager.monitoredRegions'")
return []
},
requestAlwaysAuthorization: { .failing("LocationManager.requestAlwaysAuthorization") },
requestLocation: { .failing("LocationManager.requestLocation") },
requestAlwaysAuthorization: { .unimplemented("LocationManager.requestAlwaysAuthorization") },
requestLocation: { .unimplemented("LocationManager.requestLocation") },
requestWhenInUseAuthorization: {
.failing("LocationManager.requestWhenInUseAuthorization")
.unimplemented("LocationManager.requestWhenInUseAuthorization")
},
requestTemporaryFullAccuracyAuthorization: { _ in
.failing("LocationManager.requestTemporaryFullAccuracyAuthorization")
.unimplemented("LocationManager.requestTemporaryFullAccuracyAuthorization")
},
set: { _ in .failing("LocationManager.set") },
set: { _ in .unimplemented("LocationManager.set") },
significantLocationChangeMonitoringAvailable: {
XCTFail()
return false
},
startMonitoringForRegion: { _ in .failing("LocationManager.startMonitoringForRegion") },
startMonitoringForRegion: { _ in .unimplemented("LocationManager.startMonitoringForRegion") },
startMonitoringSignificantLocationChanges: {
.failing("LocationManager.startMonitoringSignificantLocationChanges")
.unimplemented("LocationManager.startMonitoringSignificantLocationChanges")
},
startMonitoringVisits: { .failing("LocationManager.startMonitoringVisits") },
startUpdatingHeading: { .failing("LocationManager.startUpdatingHeading") },
startUpdatingLocation: { .failing("LocationManager.startUpdatingLocation") },
stopMonitoringForRegion: { _ in .failing("LocationManager.stopMonitoringForRegion") },
startMonitoringVisits: { .unimplemented("LocationManager.startMonitoringVisits") },
startUpdatingHeading: { .unimplemented("LocationManager.startUpdatingHeading") },
startUpdatingLocation: { .unimplemented("LocationManager.startUpdatingLocation") },
stopMonitoringForRegion: { _ in .unimplemented("LocationManager.stopMonitoringForRegion") },
stopMonitoringSignificantLocationChanges: {
.failing("LocationManager.stopMonitoringSignificantLocationChanges")
.unimplemented("LocationManager.stopMonitoringSignificantLocationChanges")
},
stopMonitoringVisits: { .failing("LocationManager.stopMonitoringVisits") },
stopUpdatingHeading: { .failing("LocationManager.stopUpdatingHeading") },
stopUpdatingLocation: { .failing("LocationManager.stopUpdatingLocation") }
stopMonitoringVisits: { .unimplemented("LocationManager.stopMonitoringVisits") },
stopUpdatingHeading: { .unimplemented("LocationManager.stopUpdatingHeading") },
stopUpdatingLocation: { .unimplemented("LocationManager.stopUpdatingLocation") }
)
}
41 changes: 20 additions & 21 deletions Sources/ComposableCoreLocation/Interface.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Combine
import ComposableArchitecture
import CoreLocation

/// A wrapper around Core Location's `CLLocationManager` that exposes its functionality through
Expand Down Expand Up @@ -257,9 +256,9 @@ public struct LocationManager {

public var authorizationStatus: () -> CLAuthorizationStatus

public var delegate: () -> EffectPublisher<Action, Never>
public var delegate: () -> AnyPublisher<Action, Never>

public var dismissHeadingCalibrationDisplay: () -> EffectPublisher<Never, Never>
public var dismissHeadingCalibrationDisplay: () -> AnyPublisher<Never, Never>

public var heading: () -> Heading?

Expand All @@ -275,37 +274,37 @@ public struct LocationManager {

public var monitoredRegions: () -> Set<Region>

public var requestAlwaysAuthorization: () -> EffectPublisher<Never, Never>
public var requestAlwaysAuthorization: () -> AnyPublisher<Never, Never>

public var requestLocation: () -> EffectPublisher<Never, Never>
public var requestLocation: () -> AnyPublisher<Never, Never>

public var requestWhenInUseAuthorization: () -> EffectPublisher<Never, Never>
public var requestWhenInUseAuthorization: () -> AnyPublisher<Never, Never>

public var requestTemporaryFullAccuracyAuthorization: (String) -> EffectPublisher<Never, Error>
public var requestTemporaryFullAccuracyAuthorization: (String) -> AnyPublisher<Never, Error>

public var set: (Properties) -> EffectPublisher<Never, Never>
public var set: (Properties) -> AnyPublisher<Never, Never>

public var significantLocationChangeMonitoringAvailable: () -> Bool

public var startMonitoringForRegion: (Region) -> EffectPublisher<Never, Never>
public var startMonitoringForRegion: (Region) -> AnyPublisher<Never, Never>

public var startMonitoringSignificantLocationChanges: () -> EffectPublisher<Never, Never>
public var startMonitoringSignificantLocationChanges: () -> AnyPublisher<Never, Never>

public var startMonitoringVisits: () -> EffectPublisher<Never, Never>
public var startMonitoringVisits: () -> AnyPublisher<Never, Never>

public var startUpdatingHeading: () -> EffectPublisher<Never, Never>
public var startUpdatingHeading: () -> AnyPublisher<Never, Never>

public var startUpdatingLocation: () -> EffectPublisher<Never, Never>
public var startUpdatingLocation: () -> AnyPublisher<Never, Never>

public var stopMonitoringForRegion: (Region) -> EffectPublisher<Never, Never>
public var stopMonitoringForRegion: (Region) -> AnyPublisher<Never, Never>

public var stopMonitoringSignificantLocationChanges: () -> EffectPublisher<Never, Never>
public var stopMonitoringSignificantLocationChanges: () -> AnyPublisher<Never, Never>

public var stopMonitoringVisits: () -> EffectPublisher<Never, Never>
public var stopMonitoringVisits: () -> AnyPublisher<Never, Never>

public var stopUpdatingHeading: () -> EffectPublisher<Never, Never>
public var stopUpdatingHeading: () -> AnyPublisher<Never, Never>

public var stopUpdatingLocation: () -> EffectPublisher<Never, Never>
public var stopUpdatingLocation: () -> AnyPublisher<Never, Never>

/// Updates the given properties of a uniquely identified `CLLocationManager`.
public func set(
Expand All @@ -317,9 +316,9 @@ public struct LocationManager {
headingOrientation: CLDeviceOrientation? = nil,
pausesLocationUpdatesAutomatically: Bool? = nil,
showsBackgroundLocationIndicator: Bool? = nil
) -> EffectPublisher<Never, Never> {
) -> AnyPublisher<Never, Never> {
#if os(macOS) || os(tvOS) || os(watchOS)
return .none
return Empty().eraseToAnyPublisher()
#else
return self.set(
Properties(
Expand All @@ -340,7 +339,7 @@ public struct LocationManager {
extension LocationManager {
public struct Properties: Equatable {
var activityType: CLActivityType? = nil

var allowsBackgroundLocationUpdates: Bool? = nil

var desiredAccuracy: CLLocationAccuracy? = nil
Expand Down
Loading

0 comments on commit 5da8eaf

Please sign in to comment.