Skip to content

Instantly share code, notes, and snippets.

@inamiy
Created December 19, 2022 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inamiy/75f3fb963aa021de7d709d6f549e14db to your computer and use it in GitHub Desktop.
Save inamiy/75f3fb963aa021de7d709d6f549e14db to your computer and use it in GitHub Desktop.
non-`Sendable` cannot cross actor boundary
public actor A {
nonisolated let mySendable: MySendable
nonisolated let nonSendable: NonSendable
public init() {
self.mySendable = MySendable()
self.nonSendable = NonSendable()
}
public nonisolated var forwardedMySendable: MySendable {
self.mySendable
}
// Warning: Non-sendable type 'NonSendable' in asynchronous access to nonisolated property 'nonSendable' cannot cross actor boundary
public nonisolated var forwardedNonSendable: NonSendable {
self.nonSendable
}
}
public struct MySendable: Sendable {
public init() {}
}
public struct NonSendable {
public init() {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment