vanvoorden
(Rick van Voorden)
1
Hi! I'm working with some KeyPath types and Strict Concurrency. I'm seeing some warnings and trying to following along with SE-0418… but I'm not sure I understand how I can make the compiler happy.
Here is a (simple) example:
struct User {
var name: String
}
let name: KeyPath<User, String> & Sendable = \.name
// warning: Type 'WritableKeyPath<User, String>' does not conform to the 'Sendable' protocol; this is an error in the Swift 6 language mode
My understanding (from SE-0418) is this explicit adoption of Sendable should be ok… is there something I am missing here?
This is building from Xcode 16.0 beta (16A5171c). My swift package requires 6.0 and adds enableExperimentalFeature("StrictConcurrency").
1 Like
hborla
(Holly Borla)
2
It sounds like the upcoming feature from SE-0418 is not enabled. Try adding .enableUpcomingFeature("InferSendableFromCaptures") to your package manifest
3 Likes
vanvoorden
(Rick van Voorden)
3
Ahh… correct! That fixes the warning. Thanks!