Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions proposals/0316-global-actors.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func notOnTheMainActor() async {
increaseTextSize() // error: increaseTextSize is isolated to MainActor, cannot call synchronously
await increaseTextSize() // okay: asynchronous call hops over to the main thread and executes there
}
```
```

### Defining global actors

Expand Down Expand Up @@ -316,7 +316,7 @@ Declarations that are not explicitly annotated with either a global actor or `no
}
```

* A non-actor type that conforms to a global-actor-qualified protocol within the same source file as its primary definition infers actor isolation from that protocol:
* A non-actor type that conforms to a global-actor-qualified protocol in its primary definition infers actor isolation from that protocol:

```swift
@MainActor protocol P {
Expand All @@ -325,6 +325,12 @@ Declarations that are not explicitly annotated with either a global actor or `no

class C: P { } // C is implicitly @MainActor

class C2 { }

extension C2: P { // C2 is not implicitly @MainActor
func updateUI() { } // okay, implicitly @MainActor
}

// source file D.swift
class D { }

Expand Down