Created
December 19, 2022 14:58
-
-
Save inamiy/75f3fb963aa021de7d709d6f549e14db to your computer and use it in GitHub Desktop.
non-`Sendable` cannot cross actor boundary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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