Running this snippet in a playground on the Xcode 13.3 beta warns for passing a Date
across actors:
@MainActor
class MainClass {
func run1(date: Date) async throws {
print("DATE \(date)")
}
}
let playgroundTask = Task {
let mc = await MainClass()
// Warns: "Cannot pass argument of non-sendable type 'Date' across actors"
try await mc.run1(date: Date.now)
}
Given that Date
is a struct with only one property of type TimeInterval
(Double) I was surprised that it isn't automatically marked as Sendable
.
Is my thinking wrong around this?
Thanks!