Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tca in favor of combine-only approach to core location dependencies #40

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 3 additions & 93 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,102 +1,12 @@
{
"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",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay.git",
"state" : {
"revision" : "50843cbb8551db836adec2290bb4bc6bac5c1865",
"version" : "0.9.0"
"revision" : "23cbf2294e350076ea4dbd7d5d047c1e76b03631",
"version" : "1.0.2"
}
}
],
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",
"0.9.0"..<"2.0.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
Loading