Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are extensions of @MainActor classes on the main actor?

If a class is on @MainActor:

@MainActor class MyClass : NSObject
{
}

does this put all its extensions on @MainActor as well?

extension MyClass
{
}
like image 821
meaning-matters Avatar asked Oct 16 '25 04:10

meaning-matters


1 Answers

Yes. As SE-0316 - Global actors says:

A type declared with a global actor attribute propagates the attribute to all methods, properties, subscripts, and extensions of the type by default.

like image 125
Rob Avatar answered Oct 17 '25 19:10

Rob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!