Skip to content

Commit

Permalink
Update library to work with TCA 0.57 (#35)
Browse files Browse the repository at this point in the history
* Update library to work with TCA 0.57

This change updates all references to `Effect` to `EffectPublisher`, and cleans up a few warnings with `LocationManager.failing` by using the more recent `XCTUnimplemented` function, though it doesn't update the signature to use a function at this time. This should let the library compile for versions of tca >= 0.43, including 0.57 which broke the old 2-generic clause `Effect`

I've confirmed that tests pass on tca 0.43 and 0.57, but not on versions in between

* Undo changes to failing client

* Match swift tools verstion that swift-composable-architecture uses

* Update ci.yml

* update makefile to use iphone 14 simulator

* fix build issues with example workspace, and remove unavailable annotations that will fail to compile in xcode 15

* Fix example test builds

* wip

---------

Co-authored-by: Stephen Celis <[email protected]>
Co-authored-by: Stephen Celis <[email protected]>
  • Loading branch information
3 people authored Aug 24, 2023
1 parent fd8d9cc commit b7bdcda
Show file tree
Hide file tree
Showing 14 changed files with 282 additions and 258 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions Examples/LocationManager/Common/AppCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public struct AppEnvironment {
private struct LocationManagerId: Hashable {}
private struct CancelSearchId: Hashable {}

public let appReducer = Reducer<AppState, AppAction, AppEnvironment> { state, action, environment in
public let appReducer = AnyReducer<AppState, AppAction, AppEnvironment> { state, action, environment in
switch action {
case let .categoryButtonTapped(category):
guard category != state.pointOfInterestCategory else {
Expand Down Expand Up @@ -188,7 +188,7 @@ public let appReducer = Reducer<AppState, AppAction, AppEnvironment> { state, ac
.signpost()
.debug()

private let locationManagerReducer = Reducer<AppState, LocationManager.Action, AppEnvironment> {
private let locationManagerReducer = AnyReducer<AppState, LocationManager.Action, AppEnvironment> {
state, action, environment in

switch action {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import ComposableArchitecture
import MapKit

public struct LocalSearchClient {
public var search: (MKLocalSearch.Request) -> Effect<LocalSearchResponse, Error>
public var search: (MKLocalSearch.Request) -> EffectPublisher<LocalSearchResponse, Error>

public init(search: @escaping (MKLocalSearch.Request) -> Effect<LocalSearchResponse, Error>) {
public init(search: @escaping (MKLocalSearch.Request) -> EffectPublisher<LocalSearchResponse, Error>) {
self.search = search
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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), _):
Expand Down
4 changes: 2 additions & 2 deletions Examples/LocationManager/CommonTests/CommonTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -71,7 +71,7 @@
CA74946F2474A4F100B13019 /* Client.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = "<group>"; };
CA7494702474A4F100B13019 /* Models.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = "<group>"; };
CA7494712474A4F100B13019 /* Live.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Live.swift; sourceTree = "<group>"; };
CA7494722474A4F100B13019 /* AppCore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppCore.swift; sourceTree = "<group>"; };
CA7494722474A4F100B13019 /* AppCore.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = AppCore.swift; sourceTree = "<group>"; 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 = "<group>"; };
CA7494A52474A65400B13019 /* LocationManagerDesktopTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LocationManagerDesktopTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 2 additions & 2 deletions Examples/LocationManager/Mobile/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>To show points of interests near you.</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand All @@ -39,8 +41,6 @@
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>To show points of interests near you.</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Loading

0 comments on commit b7bdcda

Please sign in to comment.