|
31 | 31 | ///
|
32 | 32 | /// To declare conformance to `Sendable` without any compiler enforcement,
|
33 | 33 | /// write `@unchecked Sendable`.
|
34 |
| -/// You are responsible for the correctness of unchecked sendable types, for example, by protecting all access to its state with a lock or a queue. |
| 34 | +/// You are responsible for the correctness of unchecked sendable types, |
| 35 | +/// for example, by protecting all access to its state with a lock or a queue. |
35 | 36 | /// Unchecked conformance to `Sendable` also disables enforcement
|
36 | 37 | /// of the rule that conformance must be in the same file.
|
37 | 38 | ///
|
|
56 | 57 | ///
|
57 | 58 | /// Otherwise, you need to declare conformance to `Sendable` explicitly.
|
58 | 59 | ///
|
59 |
| -/// ### Sendable Actors and Classes |
| 60 | +/// ### Sendable Actors |
60 | 61 | ///
|
61 |
| -/// All actor types implicitly conform to `Sendable`. |
| 62 | +/// All actor types implicitly conform to `Sendable` |
| 63 | +/// because actors ensure that all access to their mutable state |
| 64 | +/// is performed sequentially. |
| 65 | +/// |
| 66 | +/// ### Sendable Classes |
62 | 67 | ///
|
63 | 68 | /// To satisfy the requirements of the `Sendable` protocol,
|
64 |
| -/// final classes must contain only immutable stored properties, |
65 |
| -/// and must either be a subclass of `NSObject` or have no superclass. |
| 69 | +/// a class must: |
| 70 | +/// |
| 71 | +/// - Be marked `final` |
| 72 | +/// |
| 73 | +/// - Contain only stored properties that are immutable and sendable |
| 74 | +/// |
| 75 | +/// - Have no superclass or have `NSObject` as the superclass |
| 76 | +/// |
| 77 | +/// Classes marked with `@MainActor` are implicitly sendable, |
| 78 | +/// because the main actor coordinates all access to its state. |
| 79 | +/// These classes can have stored properties that are mutable and nonsendable. |
66 | 80 | ///
|
67 |
| -/// Other classes can be marked as `@unchecked Sendable`, |
| 81 | +/// Classes that don't meet the requirements above |
| 82 | +/// can be marked as `@unchecked Sendable`, |
68 | 83 | /// disabling compile-time correctness checks,
|
69 |
| -/// after you manually verify that they satisfy the semantic requirements. |
| 84 | +/// after you manually verify that |
| 85 | +/// they satisfy the `Sendable` protocol's semantic requirements. |
70 | 86 | ///
|
71 | 87 | /// ### Sendable Functions and Closures
|
72 | 88 | ///
|
|
0 commit comments