Swift concurrency nOOb question: if you're using Approachable Concurrency and you get warnings about using Sendable structs in non-main-actor contexts, is the recommended workaround to mark them as nonisolated?

Also, it seems odd to me that marking a struct as Sendable doesn't already exempt it from default MainActor isolation. Is there a good reason why you'd want to limit Sendable types to MainActor?

@nicklockwood since no one else seems to have said it directly.

MainActor default is an independent feature from the thing in Xcode labeled “Approachable Concurrency”.

And yes. When you turn on that default, it is normal to need to make things nonisolated.

@nicklockwood and for the second part, I was surprised explicit Sendable does not exempt things too. But yes, there is are good reasons and they are outlined in the proposal.

But in practice I think that is rarely what you actually want. Nonisolated types are “normal”, and you’ll find you have to use that keyword a lot in this mode.