# \#actors

**URL:** https://forums.swift.org/tag/actors/536.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [Cadence – rate limiting, debouncing & request coalescing (zero-dependency, Swift 6)](https://forums.swift.org/t/cadence-rate-limiting-debouncing-request-coalescing-zero-dependency-swift-6/88790)

<div class="topic-metadata">

**Author:** [@peteroettl](https://forums.swift.org/u/peteroettl)\
**Replies:** 0\
**Last updated:** [August 5, 2026, 9:09am UTC](https://forums.swift.org/t/cadence-rate-limiting-debouncing-request-coalescing-zero-dependency-swift-6/88790 "2026-08-05T09:09:11Z")

</div>

I've open-sourced Cadence, a small Swift 6 concurrency library for pacing outbound requests. It came out of a weather app that hammers a strictly rate-limited public API from an app, a widget, and a watch complication …

---

## [Stop using @unchecked Sendable](https://forums.swift.org/t/stop-using-unchecked-sendable/88629)

<div class="topic-metadata">

**Author:** [@soumyamahunt](https://forums.swift.org/u/soumyamahunt)\
**Replies:** 1\
**Last updated:** [July 29, 2026, 4:39pm UTC](https://forums.swift.org/t/stop-using-unchecked-sendable/88629 "2026-07-29T16:39:24Z")

</div>

While migrating a large SDK to the Swift 6 language mode, I wanted to avoid blanket @unchecked Sendable on our existing lock-guarded types. The pattern I landed on: implement SerialExecutor over NSRecursiveLock (jobs run…

---

## [Isolated type vs. Sendable isolated type](https://forums.swift.org/t/isolated-type-vs-sendable-isolated-type/88108)

<div class="topic-metadata">

**Author:** [@a7medev](https://forums.swift.org/u/a7medev)\
**Replies:** 8\
**Last updated:** [July 8, 2026, 5:02am UTC](https://forums.swift.org/t/isolated-type-vs-sendable-isolated-type/88108 "2026-07-08T05:02:58Z")

</div>

Why does this code compile: @MainActor protocol P: Sendable {} @MainActor class C { let p: any P nonisolated init(p: any P) { self.p = p } } While this does not? @MainActor protocol P {} @Ma…

---

## [Global actor as TaskLocal](https://forums.swift.org/t/global-actor-as-tasklocal/87303)

<div class="topic-metadata">

**Author:** [@soumyamahunt](https://forums.swift.org/u/soumyamahunt)\
**Replies:** 18\
**Last updated:** [June 23, 2026, 8:21am UTC](https://forums.swift.org/t/global-actor-as-tasklocal/87303 "2026-06-23T08:21:26Z")

</div>

In my code base I am using a global actor across my code base and using swift testing to tests various parts. Swift tests is configured to run tasks in parallel. I noticed some of my tests are flakey and failing randoml…

---

## [Actor Races](https://forums.swift.org/t/actor-races/60439)

<div class="topic-metadata">

**Author:** [@drewmccormack](https://forums.swift.org/u/drewmccormack)\
**Replies:** 96\
**Last updated:** [May 21, 2026, 2:35pm UTC](https://forums.swift.org/t/actor-races/60439 "2026-05-21T14:35:03Z")

</div>

I was quite excited when actors were added to Swift, because much of my code is already structured with actor-like classes, utilizing OperationQueue or DispatchQueue. Unfortunately, they have fallen short of my expectati…

---

## [Error when referencing an actor’s method’s type](https://forums.swift.org/t/error-when-referencing-an-actor-s-method-s-type/86642)

<div class="topic-metadata">

**Author:** [@ibex](https://forums.swift.org/u/ibex)\
**Replies:** 1\
**Last updated:** [May 11, 2026, 7:27am UTC](https://forums.swift.org/t/error-when-referencing-an-actor-s-method-s-type/86642 "2026-05-11T07:27:51Z")

</div>

Extract from SE-0313 (actor-isolation control): This makes instance methods on actor types less special, because now they are expressible in terms of a general feature: they are methods for which the self parameter is i…

---

## [Should this be a Swift 6 error? (Actors + Sendable closures)](https://forums.swift.org/t/should-this-be-a-swift-6-error-actors-sendable-closures/86471)

<div class="topic-metadata">

**Author:** [@bjhomer](https://forums.swift.org/u/bjhomer)\
**Replies:** 7\
**Last updated:** [May 6, 2026, 3:33pm UTC](https://forums.swift.org/t/should-this-be-a-swift-6-error-actors-sendable-closures/86471 "2026-05-06T15:33:06Z")

</div>

I am working toward a Swift 6 migration. I found the following code produces a warning in Swift 5, which makes sense. I would have thought that it would have been a hard error in Swift 6, but at least in Swift 6.3, this …

---

## [Swift-chat: Showcase for distributed application](https://forums.swift.org/t/swift-chat-showcase-for-distributed-application/67803)

<div class="topic-metadata">

**Author:** [@jaleel](https://forums.swift.org/u/jaleel)\
**Replies:** 17\
**Last updated:** [April 10, 2026, 9:40pm UTC](https://forums.swift.org/t/swift-chat-showcase-for-distributed-application/67803 "2026-04-10T21:40:34Z")

</div>

Work in Progress swift-chat is a simple distributed application created to explore and showcase distributed actors. After the announcement of distributed actors, I was excited and began to dive deeper into the topic. U…

---

## [Created task unable to inherit actor isolation](https://forums.swift.org/t/created-task-unable-to-inherit-actor-isolation/84734)

<div class="topic-metadata">

**Author:** [@soumyamahunt](https://forums.swift.org/u/soumyamahunt)\
**Replies:** 1\
**Last updated:** [February 14, 2026, 11:39am UTC](https://forums.swift.org/t/created-task-unable-to-inherit-actor-isolation/84734 "2026-02-14T11:39:07Z")

</div>

I have an use-case for actor which matches following snippet: actor SomeActor { let executor = DispatchSerialQueue(label: "serial") var counter = 0 nonisolated var unownedExecutor: UnownedSerialExecutor { ex…

---

## [Queries regarding lifetime of Job passed to executor](https://forums.swift.org/t/queries-regarding-lifetime-of-job-passed-to-executor/84128)

<div class="topic-metadata">

**Author:** [@soumyamahunt](https://forums.swift.org/u/soumyamahunt)\
**Replies:** 2\
**Last updated:** [January 14, 2026, 12:19pm UTC](https://forums.swift.org/t/queries-regarding-lifetime-of-job-passed-to-executor/84128 "2026-01-14T12:19:46Z")

</div>

Hi All. I have gone through the Job documentations: The consuming variant of Job is only available from iOS 17+, for earlier versions the Job being passed to executor is of type UnownedJob. Does the lifetime of th…

---

## [Experiences from my multiplayer game designing with concurrency in mind](https://forums.swift.org/t/experiences-from-my-multiplayer-game-designing-with-concurrency-in-mind/74148)

<div class="topic-metadata">

**Author:** [@maartene](https://forums.swift.org/u/maartene)\
**Replies:** 11\
**Last updated:** [January 8, 2026, 1:11pm UTC](https://forums.swift.org/t/experiences-from-my-multiplayer-game-designing-with-concurrency-in-mind/74148 "2026-01-08T13:11:56Z")

</div>

Hi everyone, In this topic I asked a question about testing for actor re-entrance. Unfortunately, testing for that is very difficult, perhaps not really possible. The topic also moved more towards design for the use ca…

---

## [Coping with non-Sendable KeyPath in a '@Sendable' closure](https://forums.swift.org/t/coping-with-non-sendable-keypath-in-a-sendable-closure/83943)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 2\
**Last updated:** [January 5, 2026, 7:01am UTC](https://forums.swift.org/t/coping-with-non-sendable-keypath-in-a-sendable-closure/83943 "2026-01-05T07:01:11Z")

</div>

I am getting a warning in this code (the code is distilled from the actual version to remove noise): import AVFoundation actor MyModel { private let device: AVCaptureDevice init(device: AVCaptureDevice) { self.…

---

## [Timers vs actors](https://forums.swift.org/t/timers-vs-actors/83944)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 3\
**Last updated:** [January 5, 2026, 5:45am UTC](https://forums.swift.org/t/timers-vs-actors/83944 "2026-01-05T05:45:43Z")

</div>

Is there something like Timer (as per API) that's compatible with actors? I cooked this one myself: final class AsyncTimer: @unchecked Sendable { var task: Task\<Void, Never\>! func invalidate() { task.c…

---

## [No Built-In AsyncLock in Swift? No atomic actor functions?](https://forums.swift.org/t/no-built-in-asynclock-in-swift-no-atomic-actor-functions/76992)

<div class="topic-metadata">

**Author:** [@urip](https://forums.swift.org/u/urip)\
**Replies:** 2\
**Last updated:** [December 30, 2025, 7:10pm UTC](https://forums.swift.org/t/no-built-in-asynclock-in-swift-no-atomic-actor-functions/76992 "2025-12-30T19:10:08Z")

</div>

This amazing structure called an actor in Swift, which is supposed to free us from all evils of concurrency, does not actually do so because it can still be re-entered by multiple execution paths between awaits (correct …

---

## [Different behaviour on adding explicit actor isolation to \`group.addTask\`](https://forums.swift.org/t/different-behaviour-on-adding-explicit-actor-isolation-to-group-addtask/83822)

<div class="topic-metadata">

**Author:** [@soumyamahunt](https://forums.swift.org/u/soumyamahunt)\
**Replies:** 4\
**Last updated:** [December 24, 2025, 6:11am UTC](https://forums.swift.org/t/different-behaviour-on-adding-explicit-actor-isolation-to-group-addtask/83822 "2025-12-24T06:11:40Z")

</div>

Hi, I am running into an use-case where I am seeing different behaviour if I add global actor isolation explicitly to group.addTask. I have declared an actor with custom executor like this: class SerialDispatchExecutor:…

---

## [Question About Actor Isolation in WWDC Video](https://forums.swift.org/t/question-about-actor-isolation-in-wwdc-video/83325)

<div class="topic-metadata">

**Author:** [@asaadjaber](https://forums.swift.org/u/asaadjaber)\
**Replies:** 8\
**Last updated:** [November 20, 2025, 11:46pm UTC](https://forums.swift.org/t/question-about-actor-isolation-in-wwdc-video/83325 "2025-11-20T23:46:57Z")

</div>

I was watching the WWDC Video, “Protect Mutable State with Swift Actors”, in which the second speaker discusses actors and protocol conformances. The speaker presents the following code example: actor LibraryAccount { …

---

## [Question about Actor Isolation in SE-0306](https://forums.swift.org/t/question-about-actor-isolation-in-se-0306/83246)

<div class="topic-metadata">

**Author:** [@asaadjaber](https://forums.swift.org/u/asaadjaber)\
**Replies:** 15\
**Last updated:** [November 18, 2025, 7:50pm UTC](https://forums.swift.org/t/question-about-actor-isolation-in-se-0306/83246 "2025-11-18T19:50:26Z")

</div>

I was reading the section about References and actor isolation in SE-0306 Actors, and I came across this code and its annotations.\[1\] actor MyActor { let name: String var counter: Int = 0 func f() } extension MyA…

---

## [Question about WWDC Video - Protect Mutable State with Swift Actors](https://forums.swift.org/t/question-about-wwdc-video-protect-mutable-state-with-swift-actors/83245)

<div class="topic-metadata">

**Author:** [@asaadjaber](https://forums.swift.org/u/asaadjaber)\
**Replies:** 4\
**Last updated:** [November 16, 2025, 2:30pm UTC](https://forums.swift.org/t/question-about-wwdc-video-protect-mutable-state-with-swift-actors/83245 "2025-11-16T14:30:57Z")

</div>

In the WWDC talk, “Protect Mutable State with Swift Actors”, the speaker gives an example of a data race and states: “This is expected, and in both cases, the counter would be left in a consistent state.“ What does the s…

---

## [What does non-isolated mean in SE-0306?](https://forums.swift.org/t/what-does-non-isolated-mean-in-se-0306/83191)

<div class="topic-metadata">

**Author:** [@asaadjaber](https://forums.swift.org/u/asaadjaber)\
**Replies:** 4\
**Last updated:** [November 13, 2025, 5:54pm UTC](https://forums.swift.org/t/what-does-non-isolated-mean-in-se-0306/83191 "2025-11-13T17:54:34Z")

</div>

I was reading proposal SE-0306 Actors, and I came across the term “non-isolated”, which is specifically used in: Section about Closures: Actors prevent this data race by specifying that a @Sendable closure … is always…

---

## [AsyncSequence version of notifications is causing memory leaks](https://forums.swift.org/t/asyncsequence-version-of-notifications-is-causing-memory-leaks/77257)

<div class="topic-metadata">

**Author:** [@crontab](https://forums.swift.org/u/crontab)\
**Replies:** 21\
**Last updated:** [October 7, 2025, 6:29pm UTC](https://forums.swift.org/t/asyncsequence-version-of-notifications-is-causing-memory-leaks/77257 "2025-10-07T18:29:39Z")

</div>

Possibly a stupid question, but I'm new to AsyncSequence and friends, and I don't understand how to terminate the following loop. The function is taken from Apple's AVCam demo app: actor CaptureService { // ... …

---

## [Sending NonSendable value error disappear when wrapping the expression in a local closure](https://forums.swift.org/t/sending-nonsendable-value-error-disappear-when-wrapping-the-expression-in-a-local-closure/82054)

<div class="topic-metadata">

**Author:** [@Serika\_PHB](https://forums.swift.org/u/Serika_PHB)\
**Replies:** 3\
**Last updated:** [September 12, 2025, 2:24am UTC](https://forums.swift.org/t/sending-nonsendable-value-error-disappear-when-wrapping-the-expression-in-a-local-closure/82054 "2025-09-12T02:24:34Z")

</div>

In the following code, method testA in MyActor takes in an NonSendable value that it does not own. Here calling function testB with this NonSendable parameter will get an error since we are trying to send this NonSendabl…

---

## [Deinit and MainActor](https://forums.swift.org/t/deinit-and-mainactor/50132)

<div class="topic-metadata">

**Author:** [@moreindirection](https://forums.swift.org/u/moreindirection)\
**Replies:** 30\
**Last updated:** [September 10, 2025, 1:43am UTC](https://forums.swift.org/t/deinit-and-mainactor/50132 "2025-09-10T01:43:29Z")

</div>

I've annotated some of my classes that should be run only on the UI thread with @MainActor. However, I'm running into a compiler error when I try to clean up resources in deinit. Here's a stripped-down example of the er…

---

## [Crash in Combine Related to Swift 6 Concurrency](https://forums.swift.org/t/crash-in-combine-related-to-swift-6-concurrency/75178)

<div class="topic-metadata">

**Author:** [@aetherealtech](https://forums.swift.org/u/aetherealtech)\
**Replies:** 5\
**Last updated:** [September 9, 2025, 2:32pm UTC](https://forums.swift.org/t/crash-in-combine-related-to-swift-6-concurrency/75178 "2025-09-09T14:32:06Z")

</div>

I was writing a test for a custom Publisher, and to simplify the asynchrony inherent in the test I marked the test function as @MainActor (that way closures can write back to reference captured local values without racin…

---

## [\`#isolation\` not providing the correct Actor in closures when NonisolatedNonsendingByDefault is enabled?](https://forums.swift.org/t/isolation-not-providing-the-correct-actor-in-closures-when-nonisolatednonsendingbydefault-is-enabled/81924)

<div class="topic-metadata">

**Author:** [@Serika\_PHB](https://forums.swift.org/u/Serika_PHB)\
**Replies:** 3\
**Last updated:** [September 9, 2025, 2:05pm UTC](https://forums.swift.org/t/isolation-not-providing-the-correct-actor-in-closures-when-nonisolatednonsendingbydefault-is-enabled/81924 "2025-09-09T14:05:11Z")

</div>

In the following example, with NonisolatedNonsendingByDefault enabled, the closure passed to a.test() should be executed on actor a. The code does pass the a.assertIsolated() assertion successfully. However, when I try t…

---

## [Typed Throws inside Actors crash the compiler](https://forums.swift.org/t/typed-throws-inside-actors-crash-the-compiler/81263)

<div class="topic-metadata">

**Author:** [@SergeyPetrachkov](https://forums.swift.org/u/SergeyPetrachkov)\
**Replies:** 6\
**Last updated:** [July 25, 2025, 10:47am UTC](https://forums.swift.org/t/typed-throws-inside-actors-crash-the-compiler/81263 "2025-07-25T10:47:02Z")

</div>

Hello there! I've been trying to use typed throws feature for a testing (not Swift Testing) framework in our team. However I'm hitting a compiler crash when I'm using actors with generic ErrorType constraint. (With ordi…

---

## [Inheritance of actor isolation for TaskGroup](https://forums.swift.org/t/inheritance-of-actor-isolation-for-taskgroup/81221)

<div class="topic-metadata">

**Author:** [@couchdeveloper](https://forums.swift.org/u/couchdeveloper)\
**Replies:** 8\
**Last updated:** [July 22, 2025, 8:03pm UTC](https://forums.swift.org/t/inheritance-of-actor-isolation-for-taskgroup/81221 "2025-07-22T20:03:32Z")

</div>

It seems, the rules for actor inheritance for Task closures and those added with addTask from a TaskGroup are not the same. I'm referring to the rules stated in SE-0420, specifically: According to SE-0304, closures pa…

---

## [Calling an actor method in a sync context: which method is better?](https://forums.swift.org/t/calling-an-actor-method-in-a-sync-context-which-method-is-better/81183)

<div class="topic-metadata">

**Author:** [@crontab](https://forums.swift.org/u/crontab)\
**Replies:** 5\
**Last updated:** [July 18, 2025, 8:56pm UTC](https://forums.swift.org/t/calling-an-actor-method-in-a-sync-context-which-method-is-better/81183 "2025-07-18T20:56:07Z")

</div>

I was wondering, what is the difference between these two calls? // A. func syncFunc() { Task { await MyActor.shared.anotherSyncFunc() } } // B. func syncFunc() { Task { @MyActor in await My…

---

## [Mutation of captured a var in concurrently-executing code, racing, how?](https://forums.swift.org/t/mutation-of-captured-a-var-in-concurrently-executing-code-racing-how/81127)

<div class="topic-metadata">

**Author:** [@realmtai](https://forums.swift.org/u/realmtai)\
**Replies:** 11\
**Last updated:** [July 16, 2025, 5:04pm UTC](https://forums.swift.org/t/mutation-of-captured-a-var-in-concurrently-executing-code-racing-how/81127 "2025-07-16T17:04:02Z")

</div>

Hello everyone, I got an error/warning of 'Mutation of captured a var in concurrently-executing code.' How does the compiler see the race condition happen? Maybe there's a fundamental misunderstanding of how Task works …

---

## [Unsafe actor access](https://forums.swift.org/t/unsafe-actor-access/80985)

<div class="topic-metadata">

**Author:** [@soumyamahunt](https://forums.swift.org/u/soumyamahunt)\
**Replies:** 0\
**Last updated:** [July 8, 2025, 3:46pm UTC](https://forums.swift.org/t/unsafe-actor-access/80985 "2025-07-08T15:46:41Z")

</div>

Currently when migrating code to concurrency code that should be isolated to GlobalActor can be marked @preconcurrency @GlobalActor to avoid breaking existing code. @globalActor actor MyGlobalActor: GlobalActor { st…

---

## [How to jump from unsafe to actor code?](https://forums.swift.org/t/how-to-jump-from-unsafe-to-actor-code/80313)

<div class="topic-metadata">

**Author:** [@robnik](https://forums.swift.org/u/robnik)\
**Replies:** 3\
**Last updated:** [June 10, 2025, 2:54pm UTC](https://forums.swift.org/t/how-to-jump-from-unsafe-to-actor-code/80313 "2025-06-10T14:54:55Z")

</div>

I don't use Swift much anymore, but I need to write some adapter code to call Apple's StoreKit from another language. I thought I would use an actor with async methods, since that seems to place nice with the StoreKit AP…

[Next page](https://forums.swift.org/tag/actors/536.md?match_all_tags=true&page=1&tags%5B%5D=actors)
