Skip to content

Commit 53af95a

Browse files
authored
Fix type-checking regression: remove dynamic case lookup on BindableAction (#2886)
1 parent 9f849e7 commit 53af95a

File tree

21 files changed

+57
-76
lines changed

21 files changed

+57
-76
lines changed

Examples/CaseStudies/SwiftUICaseStudiesTests/01-GettingStarted-BindingBasicsTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ final class BindingFormTests: XCTestCase {
1010
BindingForm()
1111
}
1212

13-
await store.send(\.sliderValue, 2) {
13+
await store.send(\.binding.sliderValue, 2) {
1414
$0.sliderValue = 2
1515
}
16-
await store.send(\.stepCount, 1) {
16+
await store.send(\.binding.stepCount, 1) {
1717
$0.sliderValue = 1
1818
$0.stepCount = 1
1919
}
20-
await store.send(\.text, "Blob") {
20+
await store.send(\.binding.text, "Blob") {
2121
$0.text = "Blob"
2222
}
23-
await store.send(\.toggleIsOn, true) {
23+
await store.send(\.binding.toggleIsOn, true) {
2424
$0.toggleIsOn = true
2525
}
2626
await store.send(.resetButtonTapped) {

Examples/SyncUps/SyncUpsTests/AppFeatureTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ final class AppFeatureTests: XCTestCase {
6565
}
6666

6767
syncUp.title = "Blob"
68-
await store.send(\.path[id:0].detail.destination.edit.syncUp, syncUp) {
68+
await store.send(\.path[id:0].detail.destination.edit.binding.syncUp, syncUp) {
6969
$0.path[id: 0]?.detail?.destination?.edit?.syncUp.title = "Blob"
7070
}
7171

Examples/SyncUps/SyncUpsTests/SyncUpDetailTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ final class SyncUpDetailTests: XCTestCase {
9696
}
9797

9898
syncUp.title = "Blob's Meeting"
99-
await store.send(\.destination.edit.syncUp, syncUp) {
99+
await store.send(\.destination.edit.binding.syncUp, syncUp) {
100100
$0.destination?.edit?.syncUp.title = "Blob's Meeting"
101101
}
102102

Examples/SyncUps/SyncUpsTests/SyncUpsListTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class SyncUpsListTests: XCTestCase {
2525
}
2626

2727
syncUp.title = "Engineering"
28-
await store.send(\.destination.add.syncUp, syncUp) {
28+
await store.send(\.destination.add.binding.syncUp, syncUp) {
2929
$0.destination?.add?.syncUp.title = "Engineering"
3030
}
3131

Examples/TicTacToe/tic-tac-toe/Tests/AppCoreTests/AppCoreTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ final class AppCoreTests: XCTestCase {
1717
}
1818
}
1919

20-
await store.send(\.login.view.email, "[email protected]") {
20+
await store.send(\.login.view.binding.email, "[email protected]") {
2121
$0.login?.email = "[email protected]"
2222
}
23-
await store.send(\.login.view.password, "bl0bbl0b") {
23+
await store.send(\.login.view.binding.password, "bl0bbl0b") {
2424
$0.login?.password = "bl0bbl0b"
2525
$0.login?.isFormValid = true
2626
}
@@ -30,7 +30,7 @@ final class AppCoreTests: XCTestCase {
3030
await store.receive(\.login.loginResponse.success) {
3131
$0 = .newGame(NewGame.State())
3232
}
33-
await store.send(\.newGame.oPlayerName, "Blob Sr.") {
33+
await store.send(\.newGame.binding.oPlayerName, "Blob Sr.") {
3434
$0.newGame?.oPlayerName = "Blob Sr."
3535
}
3636
await store.send(\.newGame.logoutButtonTapped) {
@@ -50,11 +50,11 @@ final class AppCoreTests: XCTestCase {
5050
}
5151
}
5252

53-
await store.send(\.login.view.email, "[email protected]") {
53+
await store.send(\.login.view.binding.email, "[email protected]") {
5454
$0.login?.email = "[email protected]"
5555
}
5656

57-
await store.send(\.login.view.password, "bl0bbl0b") {
57+
await store.send(\.login.view.binding.password, "bl0bbl0b") {
5858
$0.login?.password = "bl0bbl0b"
5959
$0.login?.isFormValid = true
6060
}
@@ -67,7 +67,7 @@ final class AppCoreTests: XCTestCase {
6767
$0.login?.twoFactor = TwoFactor.State(token: "deadbeef")
6868
}
6969

70-
await store.send(\.login.twoFactor.view.code, "1234") {
70+
await store.send(\.login.twoFactor.view.binding.code, "1234") {
7171
$0.login?.twoFactor?.code = "1234"
7272
$0.login?.twoFactor?.isFormValid = true
7373
}

Examples/TicTacToe/tic-tac-toe/Tests/LoginCoreTests/LoginCoreTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ final class LoginCoreTests: XCTestCase {
1818
}
1919
}
2020

21-
await store.send(\.view.email, "[email protected]") {
21+
await store.send(\.view.binding.email, "[email protected]") {
2222
$0.email = "[email protected]"
2323
}
24-
await store.send(\.view.password, "password") {
24+
await store.send(\.view.binding.password, "password") {
2525
$0.password = "password"
2626
$0.isFormValid = true
2727
}
@@ -32,7 +32,7 @@ final class LoginCoreTests: XCTestCase {
3232
$0.isLoginRequestInFlight = false
3333
$0.twoFactor = TwoFactor.State(token: "deadbeefdeadbeef")
3434
}
35-
await store.send(\.twoFactor.view.code, "1234") {
35+
await store.send(\.twoFactor.view.binding.code, "1234") {
3636
$0.twoFactor?.code = "1234"
3737
$0.twoFactor?.isFormValid = true
3838
}
@@ -58,10 +58,10 @@ final class LoginCoreTests: XCTestCase {
5858
}
5959
}
6060

61-
await store.send(\.view.email, "[email protected]") {
61+
await store.send(\.view.binding.email, "[email protected]") {
6262
$0.email = "[email protected]"
6363
}
64-
await store.send(\.view.password, "password") {
64+
await store.send(\.view.binding.password, "password") {
6565
$0.password = "password"
6666
$0.isFormValid = true
6767
}
@@ -72,7 +72,7 @@ final class LoginCoreTests: XCTestCase {
7272
$0.isLoginRequestInFlight = false
7373
$0.twoFactor = TwoFactor.State(token: "deadbeefdeadbeef")
7474
}
75-
await store.send(\.twoFactor.view.code, "1234") {
75+
await store.send(\.twoFactor.view.binding.code, "1234") {
7676
$0.twoFactor?.code = "1234"
7777
$0.twoFactor?.isFormValid = true
7878
}

Examples/TicTacToe/tic-tac-toe/Tests/NewGameCoreTests/NewGameCoreTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ final class NewGameCoreTests: XCTestCase {
1010
}
1111

1212
func testFlow_NewGame_Integration() async {
13-
await self.store.send(\.oPlayerName, "Blob Sr.") {
13+
await self.store.send(\.binding.oPlayerName, "Blob Sr.") {
1414
$0.oPlayerName = "Blob Sr."
1515
}
16-
await self.store.send(\.xPlayerName, "Blob Jr.") {
16+
await self.store.send(\.binding.xPlayerName, "Blob Jr.") {
1717
$0.xPlayerName = "Blob Jr."
1818
}
1919
await self.store.send(.letsPlayButtonTapped) {

Examples/TicTacToe/tic-tac-toe/Tests/TwoFactorCoreTests/TwoFactorCoreTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ final class TwoFactorCoreTests: XCTestCase {
1414
}
1515
}
1616

17-
await store.send(\.view.code, "1") {
17+
await store.send(\.view.binding.code, "1") {
1818
$0.code = "1"
1919
}
20-
await store.send(\.view.code, "12") {
20+
await store.send(\.view.binding.code, "12") {
2121
$0.code = "12"
2222
}
23-
await store.send(\.view.code, "123") {
23+
await store.send(\.view.binding.code, "123") {
2424
$0.code = "123"
2525
}
26-
await store.send(\.view.code, "1234") {
26+
await store.send(\.view.binding.code, "1234") {
2727
$0.code = "1234"
2828
$0.isFormValid = true
2929
}
@@ -44,7 +44,7 @@ final class TwoFactorCoreTests: XCTestCase {
4444
}
4545
}
4646

47-
await store.send(\.view.code, "1234") {
47+
await store.send(\.view.binding.code, "1234") {
4848
$0.code = "1234"
4949
$0.isFormValid = true
5050
}

Examples/Todos/TodosTests/TodosTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ final class TodosTests: XCTestCase {
5656
Todos()
5757
}
5858

59-
await store.send(\.todos[id:UUID(0)].description, "Learn Composable Architecture") {
59+
await store.send(\.todos[id:UUID(0)].binding.description, "Learn Composable Architecture") {
6060
$0.todos[id: UUID(0)]?.description = "Learn Composable Architecture"
6161
}
6262
}
@@ -83,7 +83,7 @@ final class TodosTests: XCTestCase {
8383
$0.continuousClock = self.clock
8484
}
8585

86-
await store.send(\.todos[id:UUID(0)].isComplete, true) {
86+
await store.send(\.todos[id:UUID(0)].binding.isComplete, true) {
8787
$0.todos[id: UUID(0)]?.isComplete = true
8888
}
8989
await self.clock.advance(by: .seconds(1))
@@ -117,11 +117,11 @@ final class TodosTests: XCTestCase {
117117
$0.continuousClock = self.clock
118118
}
119119

120-
await store.send(\.todos[id:UUID(0)].isComplete, true) {
120+
await store.send(\.todos[id:UUID(0)].binding.isComplete, true) {
121121
$0.todos[id: UUID(0)]?.isComplete = true
122122
}
123123
await self.clock.advance(by: .milliseconds(500))
124-
await store.send(\.todos[id:UUID(0)].isComplete, false) {
124+
await store.send(\.todos[id:UUID(0)].binding.isComplete, false) {
125125
$0.todos[id: UUID(0)]?.isComplete = false
126126
}
127127
await self.clock.advance(by: .seconds(1))
@@ -249,7 +249,7 @@ final class TodosTests: XCTestCase {
249249
$0.continuousClock = self.clock
250250
}
251251

252-
await store.send(\.editMode, .active) {
252+
await store.send(\.binding.editMode, .active) {
253253
$0.editMode = .active
254254
}
255255
await store.send(.move([0], 2)) {
@@ -296,10 +296,10 @@ final class TodosTests: XCTestCase {
296296
$0.uuid = .incrementing
297297
}
298298

299-
await store.send(\.editMode, .active) {
299+
await store.send(\.binding.editMode, .active) {
300300
$0.editMode = .active
301301
}
302-
await store.send(\.filter, .completed) {
302+
await store.send(\.binding.filter, .completed) {
303303
$0.filter = .completed
304304
}
305305
await store.send(.move([0], 2)) {
@@ -334,10 +334,10 @@ final class TodosTests: XCTestCase {
334334
Todos()
335335
}
336336

337-
await store.send(\.filter, .completed) {
337+
await store.send(\.binding.filter, .completed) {
338338
$0.filter = .completed
339339
}
340-
await store.send(\.todos[id:UUID(1)].description, "Did this already") {
340+
await store.send(\.todos[id:UUID(1)].binding.description, "Did this already") {
341341
$0.todos[id: UUID(1)]?.description = "Did this already"
342342
}
343343
}

Sources/ComposableArchitecture/Documentation.docc/Articles/Bindings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ let store = TestStore(initialState: Settings.State()) {
295295
Settings()
296296
}
297297

298-
store.send(\.displayName, "Blob") {
298+
store.send(\.binding.displayName, "Blob") {
299299
$0.displayName = "Blob"
300300
}
301-
store.send(\.protectMyPosts, true) {
301+
store.send(\.binding.protectMyPosts, true) {
302302
$0.protectMyPosts = true
303303
)
304304
```

0 commit comments

Comments
 (0)