@@ -304,17 +304,10 @@ and interoperate with code that has not yet begun using concurrency at all.
304
304
These tools can be helpful both for code you do not own, as well as code you
305
305
do own, but cannot easily change.
306
306
307
- ``` swift
308
- @MainActor
309
- class WindowStyler : Styler {
310
- nonisolated func applyStyle () {
311
- MainActor.assumeIsolated {
312
- // implementation body
313
- }
314
- }
315
- }
307
+ Annotating a protocol conformance with ` @preconcurrency ` makes it possible to
308
+ suppress errors about any isolation mismatches.
316
309
317
- // Improved ergonomics and safety with Swift 6's DynamicActorIsolation
310
+ ``` swift
318
311
@MainActor
319
312
class WindowStyler : @preconcurrency Styler {
320
313
func applyStyle () {
@@ -323,12 +316,13 @@ class WindowStyler: @preconcurrency Styler {
323
316
}
324
317
```
325
318
326
- This technique involves two steps.
327
- It first removes any static isolation that is causing the mismatch.
328
- Then, it re-introduces the isolation dynamically, to allow useful
329
- work within the function body.
330
- This keeps the solution localized to the source of the compiler error.
331
- It is also a great option for making isolation changes incrementally.
319
+ This inserts runtime checks to ensure that that static isolation
320
+ of the conforming class is always enforced.
321
+
322
+ > Note: To learn more about incremental adoption and dynamic isolation,
323
+ see [ Dynamic Isolation] [ ]
324
+
325
+ [ Dynamic Isolation ] : incrementaladoption#Dynamic-Isolation
332
326
333
327
### Isolated Conforming Type
334
328
0 commit comments