2

The following presents a warning in Xcode 14 complete concurrency checking mode.

struct Article: Sendable {
    let title: String
    let date: Date // non sendable type warning
}

This warning will become an error in Swift 6.

How do we handle this?

bobby123uk
  • 892
  • 4
  • 17

1 Answers1

0

The sendable attribute only applies to function types, so we can convert the property to that type instead.

struct Article: Sendable {
    let title: String
    let date: @Sendable () -> Date
}
bobby123uk
  • 892
  • 4
  • 17