≈ the.bay.news

Actors conforming to protocols in default @MainActor isolation targets

Swift Forums
Actors conforming to protocols in default @MainActor isolation targets
I've come across some behavior in default @MainActor isolation targets that I can't explain. Consider the following protocol defined in a @MainActor module, and an actor that conforms to the protocol: // Default main actor isolation module protocol P { func perform() async } actor A: P { func perform() async {} } I was surprised this compiled. It seems that P is effectively @MainActor P, and so an arbitrary actor shouldn't be allowed to conform. And if I explicitly make P into @MainActor, ...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.