# Error: Actor-isolated property 'X' can not be mutated from global actor 'Y'

**URL:** <https://forums.swift.org/t/error-actor-isolated-property-x-can-not-be-mutated-from-global-actor-y/73611>\
**Category:** Using Swift\
**Tags:** concurrency\
**Created:** [August 1, 2024, 12:17am UTC](https://forums.swift.org/t/error-actor-isolated-property-x-can-not-be-mutated-from-global-actor-y/73611 "2024-08-01T00:17:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ktoso](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ktoso/32/44526_2.png) [@ktoso](https://forums.swift.org/u/ktoso)\
**Post date:** [August 1, 2024, 12:22am UTC](https://forums.swift.org/t/error-actor-isolated-property-x-can-not-be-mutated-from-global-actor-y/73611/2 "2024-08-01T00:22:59Z")

</div>

The isolation checker currently does not understand the equivalence of the `@SomeGlobalActor` and the instance, they're seen as separate isolations and therefore the issue.

The solution to your problem here specifically _would_ be provided by [Closure isolation control](https://forums.swift.org/t/closure-isolation-control/70378) but that's not been implemented for 6.0, but it's still something we're interested in doing one way or another.

It'd look like this

```swift
nonisolated func update() {
  Task { [isolated self] in
  }
}

```

Alternatively, there were proposals flying around about improving the isolation checker to understand the equivalence of an instance of a global actor to the global actor itself... (under the assumptiuon that there is just ONE such instance; you could violate this promise though). So then your code would have worked as is.

Either solutions don't exist though.

* * *

Today what I'd do is: move the state out of this actor instance entirely -- it's only going to be used as the thread serialization mechanism, and utilize the fact that you have a global actor to put state on:

```swift
@MyGlobalActor
var timeStamp = Date.now

@globalActor
actor MyGlobalActor : GlobalActor {
     nonisolated func update() {
        Task { @MyGlobalActor in
            timeStamp = .now
        }
    }
    static let shared = MyGlobalActor()
}

```

---

_[View the full topic](https://forums.swift.org/t/error-actor-isolated-property-x-can-not-be-mutated-from-global-actor-y/73611)._
