# \[Pitch\] Amend SE-0466 & SE-0470 to improve isolation inference

**URL:** <https://forums.swift.org/t/pitch-amend-se-0466-se-0470-to-improve-isolation-inference/79854>\
**Category:** Pitches\
**Created:** [May 13, 2025, 12:02am UTC](https://forums.swift.org/t/pitch-amend-se-0466-se-0470-to-improve-isolation-inference/79854 "2025-05-13T00:02:37Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Douglas\_Gregor](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/douglas_gregor/32/1362_2.png) [@Douglas\_Gregor](https://forums.swift.org/u/Douglas_Gregor)\
**Post date:** [July 1, 2025, 7:11pm UTC](https://forums.swift.org/t/pitch-amend-se-0466-se-0470-to-improve-isolation-inference/79854/8 "2025-07-01T19:11:54Z")

</div>

> [@Nickolas\_Pohilets](#):
>
> It is hard to notice that type becomes nonisolated just by conforming to the protocol. But we already have the reverse precedent - types conforming to the isolated protocols are inferred to the isolated in nonisolated-by-default mode.

Right, there's already precedent for protocols being able to affect the isolation of the type. This builds on this precedent, but definitely makes it more complicated.

> [@Nickolas\_Pohilets](#):
>
> Could you share a compilation of the examples from the provided feedback?

The general form looks like the issue I referenced, i.e.,

```swift
// <<< MyLibrary.swift
public protocol LibraryProtocol: SendableMetaType { }

// <<< ClientModule.swift (MainActor-isolated by default)
import MyLibrary

// ClientType is MainActor isolated.
// ❌ This will create compiler errors when the
// client module wants to use library features.
struct ClientType: LibraryProtocol { }

```

This came up immediately with `CodingKeys`, whether compiler-synthesized or not:

```swift
struct S: Codable {
  var a: Int

  // error: CodingKeys inferred to `@MainActor`, which makes the conformance
  // to CodingKey main-actor-isolated and then fails (because the requirements
  // need to be nonisolated).
  enum CodingKeys: CodingKey {
    case a
  }
}

```

There have been some examples from uses of Apple SDKs as well. For example, any use of the [`Transferable`](https://developer.apple.com/documentation/coretransferable/transferable) protocol effectively needs a nonisolated type.

And SwiftData's [`@Model`](https://developer.apple.com/documentation/swiftdata/model()) is meant for nonisolated types, because the keypaths formed to reference members of a model type need to be `Sendable`. This shows up, for example, when using them with Foundation's [`#Predicate`](https://developer.apple.com/documentation/swiftdata/model()):

```swift
@Model
final class Item {
    var timestamp: Date
    
    init(timestamp: Date) {
        self.timestamp = timestamp
    }
    
    var isTrue = false
    
    static let predicate = {
        #Predicate<Item> {
            $0.isTrue == true // error here because isTrue is main-actor-isolated
        }
    }()
}

```

> [@Nickolas\_Pohilets](#):
>
> Also readability issue could be mitigated by tooling.

I agree that we would benefit greatly from tooling that indicated the isolation of various language entities (conformances, types, closures, etc.).

Doug

---

_[View the full topic](https://forums.swift.org/t/pitch-amend-se-0466-se-0470-to-improve-isolation-inference/79854)._
