example.swift:13:32: warning: conformance of 'AttributedString' to 'Sendable' is unavailable; this is an error in Swift 6
let sendableString: Sendable = AttributedString()
^
Foundation.AttributedString:3:11: note: conformance of 'AttributedString' to 'Sendable' has been explicitly marked unavailable here
extension AttributedString : @unchecked Sendable {
^
Some questions about this:
Is AttributedString Sendable? Is it threadsafe?
Where is this conformance referenced at Foundation.AttributedString:3:11? Xcode cannot find it and pull it up in the editor.
The documentation states that AttributedString conforms to Sendable, yet inspecting the generated module definition for Foundation I can’t find any declaration or protocol extension for AttributedString that defines Sendable
But AttributedString is marked as public, so it wouldn’t be elligible for implicit Sendable conformance anyway:
To satisfy the requirements of the Sendable protocol, an enumeration or structure must have only sendable members and associated values. In some cases, structures and enumerations that satisfy the requirements implicitly conform to Sendable:
Frozen structures and enumerations
Structures and enumerations that aren’t public and aren’t marked @usableFromInline.
I’m still confused as to where the documentation is getting the conformance from.
Oops, of course you're right, @Luke_Lau, that slipped right past me!
In this case it seems the bug is within the documentation (at the moment), which is still weird. And of course it would be better if it wasSendable as it's a neat thing, especially in SwiftUI.