diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0483c51..6c49554 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,11 @@ on: jobs: tests: - runs-on: macOS-11.0 + runs-on: macOS-13 strategy: matrix: xcode: - - '12.5.1' - - '13.0' + - '14.3.1' steps: - uses: actions/checkout@v2 - name: Select Xcode ${{ matrix.xcode }} diff --git a/Examples/LocationManager/Common/AppCore.swift b/Examples/LocationManager/Common/AppCore.swift index 1e8a2b5..17eaac2 100644 --- a/Examples/LocationManager/Common/AppCore.swift +++ b/Examples/LocationManager/Common/AppCore.swift @@ -75,7 +75,7 @@ public struct AppEnvironment { private struct LocationManagerId: Hashable {} private struct CancelSearchId: Hashable {} -public let appReducer = Reducer { state, action, environment in +public let appReducer = AnyReducer { state, action, environment in switch action { case let .categoryButtonTapped(category): guard category != state.pointOfInterestCategory else { @@ -188,7 +188,7 @@ public let appReducer = Reducer { state, ac .signpost() .debug() -private let locationManagerReducer = Reducer { +private let locationManagerReducer = AnyReducer { state, action, environment in switch action { diff --git a/Examples/LocationManager/Common/LocalSearchClient/Client.swift b/Examples/LocationManager/Common/LocalSearchClient/Client.swift index cfc9ee5..4ef18de 100644 --- a/Examples/LocationManager/Common/LocalSearchClient/Client.swift +++ b/Examples/LocationManager/Common/LocalSearchClient/Client.swift @@ -2,9 +2,9 @@ import ComposableArchitecture import MapKit public struct LocalSearchClient { - public var search: (MKLocalSearch.Request) -> Effect + public var search: (MKLocalSearch.Request) -> EffectPublisher - public init(search: @escaping (MKLocalSearch.Request) -> Effect) { + public init(search: @escaping (MKLocalSearch.Request) -> EffectPublisher) { self.search = search } diff --git a/Examples/LocationManager/Common/LocalSearchClient/Live.swift b/Examples/LocationManager/Common/LocalSearchClient/Live.swift index 7c88112..cbd9fe6 100644 --- a/Examples/LocationManager/Common/LocalSearchClient/Live.swift +++ b/Examples/LocationManager/Common/LocalSearchClient/Live.swift @@ -5,7 +5,7 @@ import MapKit extension LocalSearchClient { public static let live = LocalSearchClient( search: { request in - Effect.future { callback in + EffectPublisher.future { callback in MKLocalSearch(request: request).start { response, error in switch (response, error) { case let (.some(response), _): diff --git a/Examples/LocationManager/CommonTests/CommonTests.swift b/Examples/LocationManager/CommonTests/CommonTests.swift index 6b9e609..286215b 100644 --- a/Examples/LocationManager/CommonTests/CommonTests.swift +++ b/Examples/LocationManager/CommonTests/CommonTests.swift @@ -149,7 +149,7 @@ class LocationManagerTests: XCTestCase { mapItems: [mapItem] ) - store.environment.localSearch.search = { _ in Effect(value: localSearchResponse) } + store.environment.localSearch.search = { _ in EffectPublisher(value: localSearchResponse) } store.send(.categoryButtonTapped(.cafe)) { $0.pointOfInterestCategory = .cafe @@ -191,7 +191,7 @@ class LocationManagerTests: XCTestCase { mapItems: [mapItem] ) - store.environment.localSearch.search = { _ in Effect(value: localSearchResponse) } + store.environment.localSearch.search = { _ in EffectPublisher(value: localSearchResponse) } let coordinateRegion = CoordinateRegion( center: CLLocationCoordinate2D(latitude: 10, longitude: 20), diff --git a/Examples/LocationManager/LocationManager.xcodeproj/project.pbxproj b/Examples/LocationManager/LocationManager.xcodeproj/project.pbxproj index 3801f6e..e8ed6e5 100644 --- a/Examples/LocationManager/LocationManager.xcodeproj/project.pbxproj +++ b/Examples/LocationManager/LocationManager.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -71,7 +71,7 @@ CA74946F2474A4F100B13019 /* Client.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = ""; }; CA7494702474A4F100B13019 /* Models.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = ""; }; CA7494712474A4F100B13019 /* Live.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Live.swift; sourceTree = ""; }; - CA7494722474A4F100B13019 /* AppCore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppCore.swift; sourceTree = ""; }; + CA7494722474A4F100B13019 /* AppCore.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = AppCore.swift; sourceTree = ""; tabWidth = 2; }; CA7494952474A59000B13019 /* LocationManagerMobileTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LocationManagerMobileTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; CA74949F2474A5C800B13019 /* CommonTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommonTests.swift; sourceTree = ""; }; CA7494A52474A65400B13019 /* LocationManagerDesktopTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LocationManagerDesktopTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -491,6 +491,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -545,6 +547,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MACOSX_DEPLOYMENT_TARGET = 10.15; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -594,7 +598,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = LocationManagerDesktop/LocationManagerDesktop.entitlements; + CODE_SIGN_ENTITLEMENTS = Desktop/LocationManagerDesktop.entitlements; CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; @@ -616,7 +620,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = LocationManagerDesktop/LocationManagerDesktop.entitlements; + CODE_SIGN_ENTITLEMENTS = Desktop/LocationManagerDesktop.entitlements; CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; diff --git a/Examples/LocationManager/LocationManager.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Examples/LocationManager/LocationManager.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index fb9ffd9..87e4e57 100644 --- a/Examples/LocationManager/LocationManager.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Examples/LocationManager/LocationManager.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,70 +1,104 @@ { - "object": { - "pins": [ - { - "package": "combine-schedulers", - "repositoryURL": "https://github.com/pointfreeco/combine-schedulers", - "state": { - "branch": null, - "revision": "4cf088c29a20f52be0f2ca54992b492c54e0076b", - "version": "0.5.3" - } - }, - { - "package": "swift-case-paths", - "repositoryURL": "https://github.com/pointfreeco/swift-case-paths", - "state": { - "branch": null, - "revision": "d226d167bd4a68b51e352af5655c92bce8ee0463", - "version": "0.7.0" - } - }, - { - "package": "swift-collections", - "repositoryURL": "https://github.com/apple/swift-collections", - "state": { - "branch": null, - "revision": "2d33a0ea89c961dcb2b3da2157963d9c0370347e", - "version": "1.0.1" - } - }, - { - "package": "swift-composable-architecture", - "repositoryURL": "https://github.com/pointfreeco/swift-composable-architecture", - "state": { - "branch": null, - "revision": "599a2398adaaa7a4e3f5420cde7728c39e33677e", - "version": "0.28.1" - } - }, - { - "package": "swift-custom-dump", - "repositoryURL": "https://github.com/pointfreeco/swift-custom-dump", - "state": { - "branch": null, - "revision": "21f8fdbb3226e5e28a1a2fffac3e0f3deec34bf0", - "version": "0.2.1" - } - }, - { - "package": "swift-identified-collections", - "repositoryURL": "https://github.com/pointfreeco/swift-identified-collections", - "state": { - "branch": null, - "revision": "f76e7d3fe4265ee09216044ec3780d74f546ca82", - "version": "0.3.1" - } - }, - { - "package": "xctest-dynamic-overlay", - "repositoryURL": "https://github.com/pointfreeco/xctest-dynamic-overlay", - "state": { - "branch": null, - "revision": "50a70a9d3583fe228ce672e8923010c8df2deddd", - "version": "0.2.1" - } + "pins" : [ + { + "identity" : "combine-schedulers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/combine-schedulers", + "state" : { + "revision" : "ec62f32d21584214a4b27c8cee2b2ad70ab2c38a", + "version" : "0.11.0" } - ] - }, - "version": 1 + }, + { + "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", + "state" : { + "revision" : "50843cbb8551db836adec2290bb4bc6bac5c1865", + "version" : "0.9.0" + } + } + ], + "version" : 2 } diff --git a/Examples/LocationManager/Mobile/Info.plist b/Examples/LocationManager/Mobile/Info.plist index 2b21583..3840680 100644 --- a/Examples/LocationManager/Mobile/Info.plist +++ b/Examples/LocationManager/Mobile/Info.plist @@ -20,6 +20,8 @@ 1 LSRequiresIPhoneOS + NSLocationWhenInUseUsageDescription + To show points of interests near you. UIApplicationSceneManifest UIApplicationSupportsMultipleScenes @@ -39,8 +41,6 @@ UILaunchStoryboardName LaunchScreen - NSLocationWhenInUseUsageDescription - To show points of interests near you. UIRequiredDeviceCapabilities armv7 diff --git a/Makefile b/Makefile index 67bf6f5..65a0269 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -PLATFORM_IOS = iOS Simulator,name=iPhone 11 Pro Max +PLATFORM_IOS = iOS Simulator,name=iPhone 14 PLATFORM_MACOS = macOS -PLATFORM_TVOS = tvOS Simulator,name=Apple TV 4K (at 1080p) -PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 4 - 44mm +PLATFORM_TVOS = tvOS Simulator,name=Apple TV 4K (3rd generation) (at 1080p) +PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 8 (45mm) default: test diff --git a/Package.resolved b/Package.resolved index fb9ffd9..87e4e57 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,70 +1,104 @@ { - "object": { - "pins": [ - { - "package": "combine-schedulers", - "repositoryURL": "https://github.com/pointfreeco/combine-schedulers", - "state": { - "branch": null, - "revision": "4cf088c29a20f52be0f2ca54992b492c54e0076b", - "version": "0.5.3" - } - }, - { - "package": "swift-case-paths", - "repositoryURL": "https://github.com/pointfreeco/swift-case-paths", - "state": { - "branch": null, - "revision": "d226d167bd4a68b51e352af5655c92bce8ee0463", - "version": "0.7.0" - } - }, - { - "package": "swift-collections", - "repositoryURL": "https://github.com/apple/swift-collections", - "state": { - "branch": null, - "revision": "2d33a0ea89c961dcb2b3da2157963d9c0370347e", - "version": "1.0.1" - } - }, - { - "package": "swift-composable-architecture", - "repositoryURL": "https://github.com/pointfreeco/swift-composable-architecture", - "state": { - "branch": null, - "revision": "599a2398adaaa7a4e3f5420cde7728c39e33677e", - "version": "0.28.1" - } - }, - { - "package": "swift-custom-dump", - "repositoryURL": "https://github.com/pointfreeco/swift-custom-dump", - "state": { - "branch": null, - "revision": "21f8fdbb3226e5e28a1a2fffac3e0f3deec34bf0", - "version": "0.2.1" - } - }, - { - "package": "swift-identified-collections", - "repositoryURL": "https://github.com/pointfreeco/swift-identified-collections", - "state": { - "branch": null, - "revision": "f76e7d3fe4265ee09216044ec3780d74f546ca82", - "version": "0.3.1" - } - }, - { - "package": "xctest-dynamic-overlay", - "repositoryURL": "https://github.com/pointfreeco/xctest-dynamic-overlay", - "state": { - "branch": null, - "revision": "50a70a9d3583fe228ce672e8923010c8df2deddd", - "version": "0.2.1" - } + "pins" : [ + { + "identity" : "combine-schedulers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/combine-schedulers", + "state" : { + "revision" : "ec62f32d21584214a4b27c8cee2b2ad70ab2c38a", + "version" : "0.11.0" } - ] - }, - "version": 1 + }, + { + "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", + "state" : { + "revision" : "50843cbb8551db836adec2290bb4bc6bac5c1865", + "version" : "0.9.0" + } + } + ], + "version" : 2 } diff --git a/Package.swift b/Package.swift index f4f6ffc..ba7336a 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.6 import PackageDescription @@ -19,7 +19,7 @@ let package = Package( dependencies: [ .package( url: "https://github.com/pointfreeco/swift-composable-architecture", - .upToNextMajor(from: "0.27.1")) + .upToNextMajor(from: "0.43.0")) ], targets: [ .target( diff --git a/Sources/ComposableCoreLocation/Interface.swift b/Sources/ComposableCoreLocation/Interface.swift index 0afb5af..23cc8a5 100644 --- a/Sources/ComposableCoreLocation/Interface.swift +++ b/Sources/ComposableCoreLocation/Interface.swift @@ -257,94 +257,57 @@ public struct LocationManager { public var authorizationStatus: () -> CLAuthorizationStatus - public var delegate: () -> Effect + public var delegate: () -> EffectPublisher - @available(macOS, unavailable) - @available(tvOS, unavailable) - public var dismissHeadingCalibrationDisplay: () -> Effect + public var dismissHeadingCalibrationDisplay: () -> EffectPublisher - @available(macOS, unavailable) - @available(tvOS, unavailable) public var heading: () -> Heading? - @available(tvOS, unavailable) public var headingAvailable: () -> Bool - @available(macOS, unavailable) - @available(tvOS, unavailable) - @available(watchOS, unavailable) public var isRangingAvailable: () -> Bool public var location: () -> Location? public var locationServicesEnabled: () -> Bool - @available(tvOS, unavailable) - @available(watchOS, unavailable) public var maximumRegionMonitoringDistance: () -> CLLocationDistance - @available(tvOS, unavailable) - @available(watchOS, unavailable) public var monitoredRegions: () -> Set - @available(tvOS, unavailable) - public var requestAlwaysAuthorization: () -> Effect + public var requestAlwaysAuthorization: () -> EffectPublisher - public var requestLocation: () -> Effect + public var requestLocation: () -> EffectPublisher - public var requestWhenInUseAuthorization: () -> Effect + public var requestWhenInUseAuthorization: () -> EffectPublisher - public var requestTemporaryFullAccuracyAuthorization: (String) -> Effect + public var requestTemporaryFullAccuracyAuthorization: (String) -> EffectPublisher - public var set: (Properties) -> Effect + public var set: (Properties) -> EffectPublisher - @available(tvOS, unavailable) - @available(watchOS, unavailable) public var significantLocationChangeMonitoringAvailable: () -> Bool - @available(tvOS, unavailable) - @available(watchOS, unavailable) - public var startMonitoringForRegion: (Region) -> Effect + public var startMonitoringForRegion: (Region) -> EffectPublisher - @available(tvOS, unavailable) - @available(watchOS, unavailable) - public var startMonitoringSignificantLocationChanges: () -> Effect + public var startMonitoringSignificantLocationChanges: () -> EffectPublisher - @available(macOS, unavailable) - @available(tvOS, unavailable) - @available(watchOS, unavailable) - public var startMonitoringVisits: () -> Effect + public var startMonitoringVisits: () -> EffectPublisher - @available(macOS, unavailable) - @available(tvOS, unavailable) - public var startUpdatingHeading: () -> Effect + public var startUpdatingHeading: () -> EffectPublisher - @available(tvOS, unavailable) - public var startUpdatingLocation: () -> Effect + public var startUpdatingLocation: () -> EffectPublisher - @available(tvOS, unavailable) - @available(watchOS, unavailable) - public var stopMonitoringForRegion: (Region) -> Effect + public var stopMonitoringForRegion: (Region) -> EffectPublisher - @available(tvOS, unavailable) - @available(watchOS, unavailable) - public var stopMonitoringSignificantLocationChanges: () -> Effect + public var stopMonitoringSignificantLocationChanges: () -> EffectPublisher - @available(macOS, unavailable) - @available(tvOS, unavailable) - @available(watchOS, unavailable) - public var stopMonitoringVisits: () -> Effect + public var stopMonitoringVisits: () -> EffectPublisher - @available(macOS, unavailable) - @available(tvOS, unavailable) - public var stopUpdatingHeading: () -> Effect + public var stopUpdatingHeading: () -> EffectPublisher - public var stopUpdatingLocation: () -> Effect + public var stopUpdatingLocation: () -> EffectPublisher /// Updates the given properties of a uniquely identified `CLLocationManager`. - @available(macOS, unavailable) - @available(tvOS, unavailable) - @available(watchOS, unavailable) public func set( activityType: CLActivityType? = nil, allowsBackgroundLocationUpdates: Bool? = nil, @@ -354,52 +317,42 @@ public struct LocationManager { headingOrientation: CLDeviceOrientation? = nil, pausesLocationUpdatesAutomatically: Bool? = nil, showsBackgroundLocationIndicator: Bool? = nil - ) -> Effect { - self.set( - Properties( - activityType: activityType, - allowsBackgroundLocationUpdates: allowsBackgroundLocationUpdates, - desiredAccuracy: desiredAccuracy, - distanceFilter: distanceFilter, - headingFilter: headingFilter, - headingOrientation: headingOrientation, - pausesLocationUpdatesAutomatically: pausesLocationUpdatesAutomatically, - showsBackgroundLocationIndicator: showsBackgroundLocationIndicator + ) -> EffectPublisher { +#if os(macOS) || os(tvOS) || os(watchOS) + return .none +#else + return self.set( + Properties( + activityType: activityType, + allowsBackgroundLocationUpdates: allowsBackgroundLocationUpdates, + desiredAccuracy: desiredAccuracy, + distanceFilter: distanceFilter, + headingFilter: headingFilter, + headingOrientation: headingOrientation, + pausesLocationUpdatesAutomatically: pausesLocationUpdatesAutomatically, + showsBackgroundLocationIndicator: showsBackgroundLocationIndicator + ) ) - ) +#endif } } extension LocationManager { public struct Properties: Equatable { - @available(macOS, unavailable) - @available(tvOS, unavailable) var activityType: CLActivityType? = nil - @available(macOS, unavailable) - @available(tvOS, unavailable) var allowsBackgroundLocationUpdates: Bool? = nil var desiredAccuracy: CLLocationAccuracy? = nil var distanceFilter: CLLocationDistance? = nil - @available(macOS, unavailable) - @available(tvOS, unavailable) var headingFilter: CLLocationDegrees? = nil - @available(macOS, unavailable) - @available(tvOS, unavailable) var headingOrientation: CLDeviceOrientation? = nil - @available(macOS, unavailable) - @available(tvOS, unavailable) - @available(watchOS, unavailable) var pausesLocationUpdatesAutomatically: Bool? = nil - @available(macOS, unavailable) - @available(tvOS, unavailable) - @available(watchOS, unavailable) var showsBackgroundLocationIndicator: Bool? = nil public static func == (lhs: Self, rhs: Self) -> Bool { diff --git a/Sources/ComposableCoreLocation/Internal/Deprecations.swift b/Sources/ComposableCoreLocation/Internal/Deprecations.swift index efcc789..1f9ec30 100644 --- a/Sources/ComposableCoreLocation/Internal/Deprecations.swift +++ b/Sources/ComposableCoreLocation/Internal/Deprecations.swift @@ -7,7 +7,7 @@ message: "Use 'Effect.cancellable' and 'Effect.cancel' to manage the lifecycle of 'LocationManager.delegate'" ) - public func create(id: AnyHashable) -> Effect { + public func create(id: AnyHashable) -> EffectPublisher { self.delegate().cancellable(id: id) } @@ -16,7 +16,7 @@ message: "Use 'Effect.cancellable' and 'Effect.cancel' to manage the lifecycle of 'LocationManager.delegate'" ) - public func destroy(id: AnyHashable) -> Effect { + public func destroy(id: AnyHashable) -> EffectPublisher { .cancel(id: id) } @@ -28,11 +28,11 @@ authorizationStatus: @escaping () -> CLAuthorizationStatus = { _unimplemented("authorizationStatus") }, - create: @escaping (_ id: AnyHashable) -> Effect = { _ in + create: @escaping (_ id: AnyHashable) -> EffectPublisher = { _ in _unimplemented("create") }, - destroy: @escaping (AnyHashable) -> Effect = { _ in _unimplemented("destroy") }, - dismissHeadingCalibrationDisplay: @escaping (AnyHashable) -> Effect = { _ in + destroy: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("destroy") }, + dismissHeadingCalibrationDisplay: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("dismissHeadingCalibrationDisplay") }, heading: @escaping (AnyHashable) -> Heading? = { _ in _unimplemented("heading") }, @@ -46,54 +46,54 @@ monitoredRegions: @escaping (AnyHashable) -> Set = { _ in _unimplemented("monitoredRegions") }, - requestAlwaysAuthorization: @escaping (AnyHashable) -> Effect = { _ in + requestAlwaysAuthorization: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("requestAlwaysAuthorization") }, - requestLocation: @escaping (AnyHashable) -> Effect = { _ in + requestLocation: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("requestLocation") }, - requestWhenInUseAuthorization: @escaping (AnyHashable) -> Effect = { _ in + requestWhenInUseAuthorization: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("requestWhenInUseAuthorization") }, - requestTemporaryFullAccuracyAuthorization: @escaping (AnyHashable, String) -> Effect< + requestTemporaryFullAccuracyAuthorization: @escaping (AnyHashable, String) -> EffectPublisher< Never, Never > = { _, _ in _unimplemented("requestTemporaryFullAccuracyAuthorization") }, - set: @escaping (_ id: AnyHashable, _ properties: Properties) -> Effect = { + set: @escaping (_ id: AnyHashable, _ properties: Properties) -> EffectPublisher = { _, _ in _unimplemented("set") }, significantLocationChangeMonitoringAvailable: @escaping () -> Bool = { _unimplemented("significantLocationChangeMonitoringAvailable") }, - startMonitoringSignificantLocationChanges: @escaping (AnyHashable) -> Effect = { + startMonitoringSignificantLocationChanges: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("startMonitoringSignificantLocationChanges") }, - startMonitoringForRegion: @escaping (AnyHashable, Region) -> Effect = { _, _ in + startMonitoringForRegion: @escaping (AnyHashable, Region) -> EffectPublisher = { _, _ in _unimplemented("startMonitoringForRegion") }, - startMonitoringVisits: @escaping (AnyHashable) -> Effect = { _ in + startMonitoringVisits: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("startMonitoringVisits") }, - startUpdatingLocation: @escaping (AnyHashable) -> Effect = { _ in + startUpdatingLocation: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("startUpdatingLocation") }, - stopMonitoringSignificantLocationChanges: @escaping (AnyHashable) -> Effect = { + stopMonitoringSignificantLocationChanges: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("stopMonitoringSignificantLocationChanges") }, - stopMonitoringForRegion: @escaping (AnyHashable, Region) -> Effect = { _, _ in + stopMonitoringForRegion: @escaping (AnyHashable, Region) -> EffectPublisher = { _, _ in _unimplemented("stopMonitoringForRegion") }, - stopMonitoringVisits: @escaping (AnyHashable) -> Effect = { _ in + stopMonitoringVisits: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("stopMonitoringVisits") }, - startUpdatingHeading: @escaping (AnyHashable) -> Effect = { _ in + startUpdatingHeading: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("startUpdatingHeading") }, - stopUpdatingHeading: @escaping (AnyHashable) -> Effect = { _ in + stopUpdatingHeading: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("stopUpdatingHeading") }, - stopUpdatingLocation: @escaping (AnyHashable) -> Effect = { _ in + stopUpdatingLocation: @escaping (AnyHashable) -> EffectPublisher = { _ in _unimplemented("stopUpdatingLocation") } ) -> Self { diff --git a/Sources/ComposableCoreLocation/Live.swift b/Sources/ComposableCoreLocation/Live.swift index 2e4acb8..92600e9 100644 --- a/Sources/ComposableCoreLocation/Live.swift +++ b/Sources/ComposableCoreLocation/Live.swift @@ -19,7 +19,7 @@ extension LocationManager { public static var live: Self { let manager = CLLocationManager() - let delegate = Effect.run { subscriber in + let delegate = EffectPublisher.run { subscriber in let delegate = LocationManagerDelegate(subscriber) manager.delegate = delegate @@ -247,9 +247,9 @@ extension LocationManager { } private class LocationManagerDelegate: NSObject, CLLocationManagerDelegate { - let subscriber: Effect.Subscriber + let subscriber: EffectPublisher.Subscriber - init(_ subscriber: Effect.Subscriber) { + init(_ subscriber: EffectPublisher.Subscriber) { self.subscriber = subscriber }