Elektrine lite

← Feed

@mortenbekditlevsen@mastodon.social

Post #1839160

2026-04-07 07:08 UTC

@rhysmorgan @mattiem Hi Rhys, Thank you for sharing. This is a real eye opener. Can you elaborate on how this is working? Why is there no race condition when mutating the person from a concurrent task? Sincerely, Morten

Replies (2)

  • @mattiem@mastodon.social 2026-04-07 09:39

    @mortenbekditlevsen @rhysmorgan I just double-checked and ViewModel is never mutated from a concurrent task. But a MainActor task does call a concurrent function.

    Open ##1839161

  • @rhysmorgan@mastodon.social 2026-04-07 10:30

    @mortenbekditlevsen @mattiem Hi Morten! I believe it’s because of the changes in Approachable Concurrency which flip how isolation works with async functions in Swift. Prior to Approachable Concurrency, all async functions ran on the global executor unless explicitly isolated. Approachable Concurrency flips that so async functions are isolated to the caller by default, which in this case would be the MainActor.

    Open ##1839163