Commit 1d9ffbb
committed
Fix: Build the test view model lazily instead of in setUp
Supersedes the previous attempt on this file. MainActor.assumeIsolated
was the wrong tool: its closure captures self, the XCTestCase, which is
not Sendable, so sending it into a main-actor closure from a nonisolated
override is itself a data race the compiler rejects.
A lazy property needs no escape hatch. Its getter is main-actor because
the class is, and XCTest creates a fresh test-case instance per test
method, so each test still gets its own view model. tearDown only nilled
the property, which per-test instances already handle.1 parent b5ad67b commit 1d9ffbb
1 file changed
Lines changed: 4 additions & 18 deletions
Lines changed: 4 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
31 | 17 | | |
32 | 18 | | |
33 | 19 | | |
| |||
0 commit comments