# What is the canonical way of writing a global actor?

**URL:** <https://forums.swift.org/t/what-is-the-canonical-way-of-writing-a-global-actor/83985>\
**Category:** Using Swift\
**Tags:** global-actors\
**Created:** [January 6, 2026, 6:29am UTC](https://forums.swift.org/t/what-is-the-canonical-way-of-writing-a-global-actor/83985 "2026-01-06T06:29:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibex](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ibex/32/30439_2.png) [@ibex](https://forums.swift.org/u/ibex)\
**Post date:** [January 6, 2026, 6:29am UTC](https://forums.swift.org/t/what-is-the-canonical-way-of-writing-a-global-actor/83985/1 "2026-01-06T06:29:14Z")

</div>

> ## Overview
> 
> A type that conforms to the `GlobalActor` protocol and is marked with the `@globalActor` attribute can be used as a custom attribute. Such types are called global actor types, and can be applied to any declaration to specify that such types are isolated to that global actor type. When using such a declaration from another actor (or from nonisolated code), synchronization is performed through the shared actor instance to ensure mutually-exclusive access to the declaration.

Is the conformance to `GlobalActor` mandatory?

I ask because these both compile, and seem to work.

Conforming to `GlobalActor`:

```swift
 @globalActor
 actor A: GlobalActor {
     static let shared: A = .init()

     private init () {}
}

```

Without conforming to `GlobalActor`:

```swift
 @globalActor
 actor A {
     static let shared: A = .init()

     private init () {}
}

```

What is the difference? 😕

---

<div class="post-metadata">

**Author:** ![CrystDragon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/crystdragon/32/10461_2.png) [@CrystDragon](https://forums.swift.org/u/CrystDragon)\
**Post date:** [January 6, 2026, 8:58am UTC](https://forums.swift.org/t/what-is-the-canonical-way-of-writing-a-global-actor/83985/2 "2026-01-06T08:58:18Z")

</div>

Simply put: no difference.

> Global actors implicitly conform to the [`GlobalActor`](https://developer.apple.com/documentation/swift/globalactor) protocol.

From [language reference](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/attributes#globalActor).
