@@ -29,20 +29,20 @@ final class ConcurrencyTests: XCTestCase {
29
29
var first = true
30
30
var observedScreen : TestScreen ?
31
31
32
- let cancellable = host. rendering . sink { rendering in
32
+ let cancellable = host. renderingPublisher . sink { rendering in
33
33
if first {
34
34
expectation. fulfill ( )
35
35
first = false
36
36
}
37
37
observedScreen = rendering
38
38
}
39
39
40
- let initialScreen = host. rendering. value
40
+ let initialScreen = host. rendering
41
41
XCTAssertEqual ( 0 , initialScreen. count)
42
42
initialScreen. update ( )
43
43
44
44
// This update happens immediately as a new rendering is generated synchronously.
45
- XCTAssertEqual ( 1 , host. rendering. value . count)
45
+ XCTAssertEqual ( 1 , host. rendering. count)
46
46
47
47
wait ( for: [ expectation] , timeout: 1.0 )
48
48
guard let screen = observedScreen else {
@@ -60,7 +60,7 @@ final class ConcurrencyTests: XCTestCase {
60
60
let renderingExpectation = expectation ( description: " Waiting on rendering values. " )
61
61
var first = true
62
62
63
- let cancellable = host. rendering . dropFirst ( ) . sink { rendering in
63
+ let cancellable = host. renderingPublisher . dropFirst ( ) . sink { rendering in
64
64
if first {
65
65
first = false
66
66
// Emit an event when the rendering is first received.
@@ -70,15 +70,15 @@ final class ConcurrencyTests: XCTestCase {
70
70
}
71
71
}
72
72
73
- let initialScreen = host. rendering. value
73
+ let initialScreen = host. rendering
74
74
XCTAssertEqual ( 0 , initialScreen. count)
75
75
76
76
// Updating the screen will cause two events - the `update` here, and the update caused by the first time the rendering changes.
77
77
initialScreen. update ( )
78
78
79
79
waitForExpectations ( timeout: 1 )
80
80
81
- XCTAssertEqual ( 2 , host. rendering. value . count)
81
+ XCTAssertEqual ( 2 , host. rendering. count)
82
82
cancellable. cancel ( )
83
83
}
84
84
@@ -88,7 +88,7 @@ final class ConcurrencyTests: XCTestCase {
88
88
let renderingExpectation = expectation ( description: " Waiting on rendering values. " )
89
89
var renderingValuesCount = 0
90
90
91
- let cancellable = host. rendering . dropFirst ( ) . sink { rendering in
91
+ let cancellable = host. renderingPublisher . dropFirst ( ) . sink { rendering in
92
92
if renderingValuesCount == 0 {
93
93
// Emit two events.
94
94
rendering. update ( )
@@ -104,15 +104,15 @@ final class ConcurrencyTests: XCTestCase {
104
104
renderingValuesCount += 1
105
105
}
106
106
107
- let initialScreen = host. rendering. value
107
+ let initialScreen = host. rendering
108
108
XCTAssertEqual ( 0 , initialScreen. count)
109
109
110
110
// Updating the screen will cause three events.
111
111
initialScreen. update ( )
112
112
113
113
waitForExpectations ( timeout: 1 )
114
114
115
- XCTAssertEqual ( 3 , host. rendering. value . count)
115
+ XCTAssertEqual ( 3 , host. rendering. count)
116
116
cancellable. cancel ( )
117
117
}
118
118
@@ -123,20 +123,20 @@ final class ConcurrencyTests: XCTestCase {
123
123
let host = WorkflowHost ( workflow: TestWorkflow ( ) )
124
124
125
125
// Capture the initial screen and corresponding closure that uses the original sink.
126
- let initialScreen = host. rendering. value
126
+ let initialScreen = host. rendering
127
127
XCTAssertEqual ( 0 , initialScreen. count)
128
128
129
129
// Send an action to the workflow. This invalidates this sink, but the next render pass declares a
130
130
// sink of the same type.
131
131
initialScreen. update ( )
132
132
133
- let secondScreen = host. rendering. value
133
+ let secondScreen = host. rendering
134
134
XCTAssertEqual ( 1 , secondScreen. count)
135
135
136
136
// Send an action from the original screen and sink. It should be proxied through the most recent sink.
137
137
initialScreen. update ( )
138
138
139
- let thirdScreen = host. rendering. value
139
+ let thirdScreen = host. rendering
140
140
XCTAssertEqual ( 2 , thirdScreen. count)
141
141
}
142
142
@@ -146,14 +146,14 @@ final class ConcurrencyTests: XCTestCase {
146
146
let host = WorkflowHost ( workflow: OneShotWorkflow ( ) )
147
147
148
148
// Capture the initial screen and corresponding closure that uses the original sink.
149
- let initialScreen = host. rendering. value
149
+ let initialScreen = host. rendering
150
150
XCTAssertEqual ( 0 , initialScreen. count)
151
151
152
152
// Send an action to the workflow. This invalidates this sink, but the next render pass declares a
153
153
// sink of the same type.
154
154
initialScreen. update ( )
155
155
156
- let secondScreen = host. rendering. value
156
+ let secondScreen = host. rendering
157
157
XCTAssertEqual ( 1 , secondScreen. count)
158
158
159
159
// Calling `update` uses the original sink. Historically this would be expected
@@ -165,7 +165,7 @@ final class ConcurrencyTests: XCTestCase {
165
165
// If the sink *was* still valid, this would be correct. However, it should just fail and be `1` still.
166
166
// XCTAssertEqual(2, secondScreen.count)
167
167
// Actual expected result, if we had not fatal errored.
168
- XCTAssertEqual ( 1 , host. rendering. value . count)
168
+ XCTAssertEqual ( 1 , host. rendering. count)
169
169
170
170
struct OneShotWorkflow : Workflow {
171
171
typealias Output = Never
@@ -228,7 +228,7 @@ final class ConcurrencyTests: XCTestCase {
228
228
var first = true
229
229
230
230
let renderingsComplete = expectation ( description: " Waiting for renderings " )
231
- let cancellable = host. rendering . dropFirst ( ) . sink { rendering in
231
+ let cancellable = host. renderingPublisher . dropFirst ( ) . sink { rendering in
232
232
if first {
233
233
first = false
234
234
rendering. update ( )
@@ -237,7 +237,7 @@ final class ConcurrencyTests: XCTestCase {
237
237
}
238
238
}
239
239
240
- let initialScreen = host. rendering. value
240
+ let initialScreen = host. rendering
241
241
initialScreen. update ( )
242
242
243
243
waitForExpectations ( timeout: 1 )
@@ -251,14 +251,14 @@ final class ConcurrencyTests: XCTestCase {
251
251
func test_childWorkflowsAreSynchronous( ) {
252
252
let host = WorkflowHost ( workflow: ParentWorkflow ( ) )
253
253
254
- let initialScreen = host. rendering. value
254
+ let initialScreen = host. rendering
255
255
XCTAssertEqual ( 0 , initialScreen. count)
256
256
initialScreen. update ( )
257
257
258
258
// This update happens immediately as a new rendering is generated synchronously.
259
259
// Both the child updates from the action (incrementing state by 1) as well as the
260
260
// parent from the output (incrementing its state by 10)
261
- XCTAssertEqual ( 11 , host. rendering. value . count)
261
+ XCTAssertEqual ( 11 , host. rendering. count)
262
262
263
263
struct ParentWorkflow : Workflow {
264
264
struct State {
@@ -317,11 +317,11 @@ final class ConcurrencyTests: XCTestCase {
317
317
outputExpectation. fulfill ( )
318
318
}
319
319
320
- let cancellable = host. rendering . sink { rendering in
320
+ let cancellable = host. renderingPublisher . sink { rendering in
321
321
renderingExpectation. fulfill ( )
322
322
}
323
323
324
- let screen = host. rendering. value
324
+ let screen = host. rendering
325
325
326
326
XCTAssertEqual ( 0 , screen. count)
327
327
@@ -330,7 +330,7 @@ final class ConcurrencyTests: XCTestCase {
330
330
331
331
wait ( for: [ renderingExpectation, outputExpectation] , timeout: 1.0 )
332
332
333
- XCTAssertEqual ( 101 , host. rendering. value . count)
333
+ XCTAssertEqual ( 101 , host. rendering. count)
334
334
335
335
cancellable. cancel ( )
336
336
outputCancellable. cancel ( )
@@ -343,18 +343,18 @@ final class ConcurrencyTests: XCTestCase {
343
343
func test_multipleAnyWorkflowAction_sinksDontOverrideEachOther( ) {
344
344
let host = WorkflowHost ( workflow: AnyActionWorkflow ( ) )
345
345
346
- let initialScreen = host. rendering. value
346
+ let initialScreen = host. rendering
347
347
XCTAssertEqual ( 0 , initialScreen. count)
348
348
349
349
// Update using the first action.
350
350
initialScreen. updateFirst ( )
351
351
352
- let secondScreen = host. rendering. value
352
+ let secondScreen = host. rendering
353
353
XCTAssertEqual ( 1 , secondScreen. count)
354
354
355
355
// Update using the second action.
356
356
secondScreen. updateSecond ( )
357
- XCTAssertEqual ( 11 , host. rendering. value . count)
357
+ XCTAssertEqual ( 11 , host. rendering. count)
358
358
359
359
struct AnyActionWorkflow : Workflow {
360
360
enum Output {
0 commit comments