Skip to content

Commit

Permalink
Update TCA to 1.1 (#184)
Browse files Browse the repository at this point in the history
* wip

* upgrade project and rename all fireAndForget to run

* wip

* wip

* wip

* Rename ReducerProtocol and EffectTask.

* Update Effect.task to use Effect.run

* wip

* Fix a few more deprecated alert view modifiers.

* update ci.yml

* fix compiler error

* fix

* wip

* wip

* fix

* wip

* wip

* more fixes

* more fixes
  • Loading branch information
mbrandonw committed Aug 15, 2023
1 parent 6eeb17e commit 33c2221
Show file tree
Hide file tree
Showing 47 changed files with 214 additions and 188 deletions.
12 changes: 6 additions & 6 deletions App/Previews/GameOverPreview/GameOverPreviewApp.swift
Expand Up @@ -41,8 +41,8 @@ extension StoreOf<GameOver> {
GameOver()
.dependency(
\.apiClient,
update(.noop) {
$0.override(
update(.noop) {
$0.override(
routeCase: (/ServerRoute.Api.Route.games)
.appending(path: /ServerRoute.Api.Route.Games.submit),
withResponse: { _ in
Expand All @@ -58,19 +58,19 @@ extension StoreOf<GameOver> {
)
)
}
)
}
)
}
)
.dependency(\.audioPlayer, .noop)
.dependency(
\.database,
.autoMigratingLive(
.autoMigratingLive(
path: FileManager.default
.urls(for: .documentDirectory, in: .userDomainMask)
.first!
.appendingPathComponent("co.pointfree.Isowords")
.appendingPathComponent("Isowords.sqlite3")
)
)
)
.dependency(\.fileClient, .noop)
.dependency(\.remoteNotifications, .noop)
Expand Down
10 changes: 5 additions & 5 deletions App/Previews/HomeFeaturePreview/HomeFeaturePreviewApp.swift
Expand Up @@ -23,9 +23,9 @@ struct HomeFeaturePreviewApp: App {
Home()
.dependency(
\.apiClient,
update(.noop) {
$0.authenticate = { _ in .init(appleReceipt: nil, player: .blob) }
$0.override(
update(.noop) {
$0.authenticate = { _ in .init(appleReceipt: nil, player: .blob) }
$0.override(
route: .dailyChallenge(.today(language: .en)),
withResponse: {
try await OK([
Expand All @@ -44,8 +44,8 @@ struct HomeFeaturePreviewApp: App {
)
])
}
)
}
)
}
)
.dependency(\.applicationClient, .noop)
.dependency(\.audioPlayer, .noop)
Expand Down
10 changes: 5 additions & 5 deletions App/Previews/TrailerPreview/TrailerPreviewApp.swift
Expand Up @@ -21,28 +21,28 @@ struct TrailerPreviewApp: App {
Trailer()
.dependency(
\.audioPlayer,
.live(bundles: [
.live(bundles: [
AppAudioLibrary.bundle,
AppClipAudioLibrary.bundle,
])
])
)
.dependency(
\.dictionary,
.init(
.init(
contains: { string, _ in
[
"SAY", "HELLO", "TO", "ISOWORDS",
"A", "NEW", "WORD", "SEARCH", "GAME",
"FOR", "YOUR", "PHONE",
"COMING", "NEXT", "YEAR",
]
.contains(string.uppercased())
.contains(string.uppercased())
},
load: { _ in true },
lookup: { _, _ in nil },
randomCubes: { _ in .mock },
unload: { _ in }
)
)
)
}
)
Expand Down
Expand Up @@ -24,8 +24,8 @@
"repositoryURL": "https://github.com/pointfreeco/combine-schedulers",
"state": {
"branch": null,
"revision": "ec62f32d21584214a4b27c8cee2b2ad70ab2c38a",
"version": "0.11.0"
"revision": "9dc9cbe4bc45c65164fa653a563d8d8db61b09bb",
"version": "1.0.0"
}
},
{
Expand Down Expand Up @@ -78,17 +78,17 @@
"repositoryURL": "https://github.com/pointfreeco/swift-case-paths",
"state": {
"branch": null,
"revision": "fc45e7b2cfece9dd80b5a45e6469ffe67fe67984",
"version": "0.14.1"
"revision": "5da6989aae464f324eef5c5b52bdb7974725ab81",
"version": "1.0.0"
}
},
{
"package": "swift-clocks",
"repositoryURL": "https://github.com/pointfreeco/swift-clocks",
"state": {
"branch": null,
"revision": "0fbaebfc013715dab44d715a4d350ba37f297e4d",
"version": "0.4.0"
"revision": "d1fd837326aa719bee979bdde1f53cd5797443eb",
"version": "1.0.0"
}
},
{
Expand All @@ -105,17 +105,17 @@
"repositoryURL": "https://github.com/pointfreeco/swift-composable-architecture",
"state": {
"branch": null,
"revision": "4cf2104cf14d57ec3dfb8cbd90d29f2b81a32028",
"version": "0.58.0"
"revision": "f62ba37cc0c51acb89f6dd1f552f6a1f9c58027c",
"version": "1.1.0"
}
},
{
"package": "swift-concurrency-extras",
"repositoryURL": "https://github.com/pointfreeco/swift-concurrency-extras",
"state": {
"branch": null,
"revision": "479750bd98fac2e813fffcf2af0728b5b0085795",
"version": "0.1.1"
"revision": "ea631ce892687f5432a833312292b80db238186a",
"version": "1.0.0"
}
},
{
Expand All @@ -132,17 +132,17 @@
"repositoryURL": "https://github.com/pointfreeco/swift-custom-dump",
"state": {
"branch": null,
"revision": "4a87bb75be70c983a9548597e8783236feb3401e",
"version": "0.11.1"
"revision": "edd66cace818e1b1c6f1b3349bb1d8e00d6f8b01",
"version": "1.0.0"
}
},
{
"package": "swift-dependencies",
"repositoryURL": "https://github.com/pointfreeco/swift-dependencies",
"state": {
"branch": null,
"revision": "16fd42ae04c6e7f74a6a86395d04722c641cccee",
"version": "0.6.0"
"revision": "4e1eb6e28afe723286d8cc60611237ffbddba7c5",
"version": "1.0.0"
}
},
{
Expand All @@ -168,8 +168,8 @@
"repositoryURL": "https://github.com/pointfreeco/swift-identified-collections",
"state": {
"branch": null,
"revision": "f52eee28bdc6065aa2f8424067e6f04c74bda6e6",
"version": "0.7.1"
"revision": "d1e45f3e1eee2c9193f5369fa9d70a6ddad635e8",
"version": "1.0.0"
}
},
{
Expand Down Expand Up @@ -240,8 +240,8 @@
"repositoryURL": "https://github.com/pointfreeco/swift-parsing",
"state": {
"branch": null,
"revision": "c6e2241daa46e5c6e5027a93b161bca6ba692bcc",
"version": "0.12.0"
"revision": "a0e7d73f462c1c38c59dc40a3969ac40cea42950",
"version": "0.13.0"
}
},
{
Expand Down Expand Up @@ -276,8 +276,8 @@
"repositoryURL": "https://github.com/pointfreeco/swift-url-routing",
"state": {
"branch": null,
"revision": "2f4f0404b3de0a0711feb7190f724d8a80bc1cfd",
"version": "0.5.0"
"revision": "13f65cec4de950ba30f08d9bc4abcfa41f9479b9",
"version": "0.6.0"
}
},
{
Expand All @@ -303,17 +303,17 @@
"repositoryURL": "https://github.com/pointfreeco/swiftui-navigation",
"state": {
"branch": null,
"revision": "2aa885e719087ee19df251c08a5980ad3e787f12",
"version": "0.8.0"
"revision": "f5bcdac5b6bb3f826916b14705f37a3937c2fd34",
"version": "1.0.0"
}
},
{
"package": "xctest-dynamic-overlay",
"repositoryURL": "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state": {
"branch": null,
"revision": "50843cbb8551db836adec2290bb4bc6bac5c1865",
"version": "0.9.0"
"revision": "23cbf2294e350076ea4dbd7d5d047c1e76b03631",
"version": "1.0.2"
}
}
]
Expand Down
10 changes: 5 additions & 5 deletions Package.swift
Expand Up @@ -27,15 +27,15 @@ var package = Package(
],
dependencies: [
.package(url: "https://github.com/apple/swift-crypto", from: "1.1.6"),
.package(url: "https://github.com/pointfreeco/swift-case-paths", from: "0.8.1"),
.package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "0.58.0"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "0.1.0"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "0.5.0"),
.package(url: "https://github.com/pointfreeco/swift-case-paths", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "1.1.0"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-gen", from: "0.3.0"),
.package(url: "https://github.com/pointfreeco/swift-parsing", from: "0.12.0"),
.package(url: "https://github.com/pointfreeco/swift-tagged", from: "0.6.0"),
.package(url: "https://github.com/pointfreeco/swift-url-routing", from: "0.2.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "0.2.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.0.0"),
.package(name: "Overture", url: "https://github.com/pointfreeco/swift-overture", from: "0.5.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.10.0"),
],
Expand Down
4 changes: 2 additions & 2 deletions Sources/AppFeature/AppDelegate.swift
Expand Up @@ -4,7 +4,7 @@ import ComposableUserNotifications
import Foundation
import SettingsFeature

public struct AppDelegateReducer: ReducerProtocol {
public struct AppDelegateReducer: Reducer {
public typealias State = UserSettings

public enum Action: Equatable {
Expand All @@ -25,7 +25,7 @@ public struct AppDelegateReducer: ReducerProtocol {

public init() {}

public func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
public func reduce(into state: inout State, action: Action) -> Effect<Action> {
switch action {
case .didFinishLaunching:
return .run { send in
Expand Down
6 changes: 3 additions & 3 deletions Sources/AppFeature/AppView.swift
Expand Up @@ -10,7 +10,7 @@ import SharedModels
import Styleguide
import SwiftUI

public struct AppReducer: ReducerProtocol {
public struct AppReducer: Reducer {
public struct State: Equatable {
public var game: Game.State?
public var onboarding: Onboarding.State?
Expand Down Expand Up @@ -84,7 +84,7 @@ public struct AppReducer: ReducerProtocol {

public init() {}

public var body: some ReducerProtocol<State, Action> {
public var body: some Reducer<State, Action> {
self.core
.ifLet(\.onboarding, action: /Action.onboarding) {
Onboarding()
Expand Down Expand Up @@ -115,7 +115,7 @@ public struct AppReducer: ReducerProtocol {
}

@ReducerBuilder<State, Action>
var core: some ReducerProtocol<State, Action> {
var core: some Reducer<State, Action> {
Scope(state: \.home.settings.userSettings, action: /Action.appDelegate) {
AppDelegateReducer()
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/AppFeature/GameCenterCore.swift
Expand Up @@ -10,7 +10,7 @@ public enum GameCenterAction: Equatable {
case rematchResponse(TaskResult<TurnBasedMatch>)
}

public struct GameCenterLogic: ReducerProtocol {
public struct GameCenterLogic: Reducer {
@Dependency(\.apiClient.currentPlayer) var currentPlayer
@Dependency(\.gameCenter) var gameCenter
@Dependency(\.mainRunLoop.now.date) var now
Expand All @@ -19,7 +19,7 @@ public struct GameCenterLogic: ReducerProtocol {

public func reduce(
into state: inout AppReducer.State, action: AppReducer.Action
) -> EffectTask<AppReducer.Action> {
) -> Effect<AppReducer.Action> {
switch action {
case .appDelegate(.didFinishLaunching):
return .run { send in
Expand Down Expand Up @@ -124,7 +124,7 @@ public struct GameCenterLogic: ReducerProtocol {
_ match: TurnBasedMatch,
state: inout AppReducer.State,
didBecomeActive: Bool
) -> EffectTask<AppReducer.Action> {
) -> Effect<AppReducer.Action> {
guard let matchData = match.matchData, !matchData.isEmpty else {
let context = TurnBasedContext(
localPlayer: self.gameCenter.localPlayer.localPlayer(),
Expand Down
4 changes: 2 additions & 2 deletions Sources/AppFeature/StoreKitCore.swift
Expand Up @@ -8,13 +8,13 @@ public struct ReceiptFinalizationEnvelope: Equatable {
let verifyEnvelope: VerifyReceiptEnvelope
}

public struct StoreKitLogic<State>: ReducerProtocol {
public struct StoreKitLogic<State>: Reducer {
@Dependency(\.apiClient) var apiClient
@Dependency(\.storeKit) var storeKit

public func reduce(
into _: inout State, action: AppReducer.Action
) -> EffectTask<AppReducer.Action> {
) -> Effect<AppReducer.Action> {
switch action {
case .appDelegate(.didFinishLaunching):
return .run { send in
Expand Down
4 changes: 2 additions & 2 deletions Sources/BottomMenu/ComposableBottomMenu.swift
Expand Up @@ -141,15 +141,15 @@ extension BottomMenuState.Button {
import ComposableArchitecture
import SwiftUIHelpers

private struct BottomMenuReducer: ReducerProtocol {
private struct BottomMenuReducer: Reducer {
typealias State = BottomMenuState<Action>?

enum Action {
case show
case dismiss
}

func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
func reduce(into state: inout State, action: Action) -> Effect<Action> {
switch action {
case .show:
state = .init(
Expand Down
4 changes: 2 additions & 2 deletions Sources/ChangelogFeature/ChangeView.swift
Expand Up @@ -4,7 +4,7 @@ import ServerConfigClient
import SwiftUI
import Tagged

public struct Change: ReducerProtocol {
public struct Change: Reducer {
public struct State: Equatable, Identifiable {
public var change: Changelog.Change
public var isExpanded = false
Expand All @@ -20,7 +20,7 @@ public struct Change: ReducerProtocol {

public init() {}

public func reduce(into state: inout State, action: Action) -> EffectTask<Action> {
public func reduce(into state: inout State, action: Action) -> Effect<Action> {
switch action {
case .showButtonTapped:
state.isExpanded.toggle()
Expand Down

0 comments on commit 33c2221

Please sign in to comment.