Warning when assigning a closure to an immutable property on a @MainActor isolated struct from a non isolated initializer

I agree that isolated function types should be @Sendable by default.

@mattie wrote a pitch for this at Implicitly Sendable Closures, and I've incorporated this pitch into a slightly larger set of tweaks to improve the usability of isolated types that I'm slowly working on fleshing out.

In your specific case, isolated function types implying @Sendable would resolve the warning.

6 Likes