# Insight needed for \`Equatable\` with Default MainActor Isolation

**URL:** <https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675>\
**Category:** Using Swift\
**Tags:** concurrency, mainactor\
**Created:** [August 16, 2025, 4:34pm UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675 "2025-08-16T16:34:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![InstantInteractive](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/instantinteractive/32/42796_2.png) [@InstantInteractive](https://forums.swift.org/u/InstantInteractive)\
**Post date:** [August 16, 2025, 4:34pm UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675/1 "2025-08-16T16:34:20Z")

</div>

I thought the following would have been resolved with [Pull Request #82383](https://github.com/swiftlang/swift/pull/82383)

I’m using default actor isolation of MainActor as well as approachable concurrency. But when I have a protocol conforming to `Equatable`, I still need to use `@MainActor` on conforming types:

```swift
protocol P1: Equatable { }

struct S1: P1 { }
// Error: Conformance of 'S1' to protocol 'P1' crosses into main actor-isolated code an can cause data races

struct S1Workaround: @MainActor P1 { }	// OK

// Another potential workaround if `Equatable` conformance can be moved to the conforming type.
protocol P2 { }

struct S2: Equatable, P2 { }	// OK

```

I filed [Issue 83610](https://github.com/swiftlang/swift/issues/83610) last week but not responses yet. Thus, posting here to see if anyone has insights to include if this is perhaps working as expected. Thank you.

---

<div class="post-metadata">

**Author:** ![InstantInteractive](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/instantinteractive/32/42796_2.png) [@InstantInteractive](https://forums.swift.org/u/InstantInteractive)\
**Post date:** [August 19, 2025, 8:05pm UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675/2 "2025-08-19T20:05:47Z")

</div>

@Douglas_Gregor Any insights here would be most appreciated. I’m trying to figure out if this is an issue with the Swift compiler, or a legitimate case of still having to use `@MainActor` when default isolation is MainActor. Thank you.

---

<div class="post-metadata">

**Author:** ![eskimo](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/eskimo/32/13558_2.png) [@eskimo](https://forums.swift.org/u/eskimo)\
**Post date:** [August 26, 2025, 11:05am UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675/3 "2025-08-26T11:05:06Z")

</div>

As this came up in [DevForums](https://developer.apple.com/forums/thread/797933), I tried reproducing it with the latest Xcode 26 beta (20.6b6, 17A5305f). Here’s what I did:

1. I created a new project from the macOS \> Command Line Tool template.

2. In the build settings, I switched [Default Actor Isolation](https://developer.apple.com/documentation/xcode/build-settings-reference#Default-Actor-Isolation) to _MainActor_.

3. I replaced `main.swift` with the text above.

4. I chose Product \> Build.

I was expecting to see the error you indicated with `S1`. I did not. The project built just fine.

Am I holding this wrong?

Well, _right_ (-:

* * *

This is a slightly more modern Swift than your [bug report](https://github.com/swiftlang/swift/issues/83610):

```shell

% DEVELOPER_DIR=/Users/quinn/XcodeZone/Xcode-beta.app/Contents/Developer xcrun swift --version

swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)

Target: arm64-apple-macosx15.0

```

Maybe it got fixed elsewhere?

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

---

<div class="post-metadata">

**Author:** ![InstantInteractive](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/instantinteractive/32/42796_2.png) [@InstantInteractive](https://forums.swift.org/u/InstantInteractive)\
**Post date:** [August 26, 2025, 11:28am UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675/4 "2025-08-26T11:28:38Z")

</div>

Thanks for the reply, Quinn! One key difference is that by default, new projects are still configured to use Swift 5. If you switch your build settings to Swift 6, you should then see the error.

I also now have the same Xcode 26 beta version; issue is still there.

---

<div class="post-metadata">

**Author:** ![eskimo](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/eskimo/32/13558_2.png) [@eskimo](https://forums.swift.org/u/eskimo)\
**Post date:** [August 27, 2025, 7:41am UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675/5 "2025-08-27T07:41:15Z")

</div>

> One key difference is that by default, new projects are still configured to use Swift 5.

D’oh! I always fall into that trap. Normally I created projects from my own custom templates that have Swift 6 enabled, but in this case I wanted to stick with a built-in template because it’s the standard.

So, yeah, once I switched the language mode to 6 I see the error as well.

As to the issue itself, it definitely seem bugworthy to me, but I’m hardly the definitive source here.

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

---

<div class="post-metadata">

**Author:** ![InstantInteractive](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/instantinteractive/32/42796_2.png) [@InstantInteractive](https://forums.swift.org/u/InstantInteractive)\
**Post date:** [September 6, 2025, 6:41pm UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675/6 "2025-09-06T18:41:31Z")

</div>

Can anyone tell me why I need to use `@MainActor Equatable` on my types that need to conform to `Equatable`? I thought the purpose of approachable concurrency and default actor isolation of MainActor would not require these workarounds.

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [September 6, 2025, 8:37pm UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675/7 "2025-09-06T20:37:21Z")

</div>

Default `MainActor` isolation acts as if you'd typed `@MainActor` on everything, so instead of having to add `MainActor` to the things you want isolated, you have to add `nonisolated` to the things you don't want isolated, like simple model types that conform to `Equatable`. Personally, those types of models are far more common than `MainActor` stuff (especially when using SwiftUI, which inherits `@MainActor` on the view bodies automatically), so I keep the setting off. And frankly, it's simpler to explain adding `@MainActor` than `nonisolated`, so that's my general recommendation too.

---

<div class="post-metadata">

**Author:** ![InstantInteractive](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/instantinteractive/32/42796_2.png) [@InstantInteractive](https://forums.swift.org/u/InstantInteractive)\
**Post date:** [September 6, 2025, 9:24pm UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675/8 "2025-09-06T21:24:22Z")

</div>

Thank you, Jon. That makes sense.

I just tried adding in `nonisolated`, but that turned out to be a huge mess. I don’t have many of these `@MainActor` workarounds in place, so I’ll leave it.

I still like the default actor isolation and approachable concurrency features as they have led to quite a bit of cleanup throughout my code.

---

<div class="post-metadata">

**Author:** ![InstantInteractive](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/instantinteractive/32/42796_2.png) [@InstantInteractive](https://forums.swift.org/u/InstantInteractive)\
**Post date:** [September 7, 2025, 2:23pm UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675/9 "2025-09-07T14:23:51Z")

</div>

Actually, something still seems off about this.

---

<div class="post-metadata">

**Author:** ![InstantInteractive](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/instantinteractive/32/42796_2.png) [@InstantInteractive](https://forums.swift.org/u/InstantInteractive)\
**Post date:** [September 24, 2025, 7:54pm UTC](https://forums.swift.org/t/insight-needed-for-equatable-with-default-mainactor-isolation/81675/10 "2025-09-24T19:54:50Z")

</div>

Update: I ended up filing a DTS incident to get clarity on this issue and it’s indeed a bug.

With that said, no idea when this will get fixed. The issue I filed against this in swiftlang on GitHub (Aug 8th) is now buried on page 5. Don’t give it much hope since so many other issues (amongst the 5,000+) seem to go unaddressed.

Hoping it does get fixed though as any developer making use of default actor isolation will no doubt run into this. And while the workaround is trivial, it’s sad to force so many developers in applying it. Far less time/energy taken if it’s simply just fixed.
