I'm testing the new "Default (Actor) Isolation: MainActor" build setting introduced in Xcode 26 / Swift 6.2 and encountered an issue. I wanted to mark all my DTO types (which are modeled as Sendable structs) as nonisolated, so they can be used freely on any actor. In these types I'm using some property wrappers that simplify the Codable implementation — e.g. LossyArray which drops invalid objects during decoding — and there seems to be a problem with that.
nonisolated struct Foo: Decodable, Sendable {
// Error: 'nonisolated' is not supported on properties with property wrappers
@LossyArray var bar: [Bar]
}
(where LossyArray is nonisolated and Sendable as well)
Is this an expected behavior?
I understand that removing isolation for a single property in an isolated type might be tricky when a wrapper is involved. But in this case the entire type is nonisolated and I'm not trying to change that property's isolation. I would expect this code to work as if the "nonisolated" was used as a value for "Default Isolation" setting instead of being added as a modifier on this particular type.