Consider some common use cases for class:
- Mutable objects that can be shared throughout the app like a
User - Editable models like a
Recipe - Shared global state like an
ImageCache
Up until now we've been responsible for synchronizing access to these objects manually. With Swift 5.5 this can now be handled automatically, with potential misuse caught by the compiler. So it seems like each of these examples is a prime candidate for actor.
So, when might we choose to use class instead?
The main limitation of actor seems to be that it doesn't support inheritance, so I guess we could say that only final classes can be migrated.
Are there any other reasons to use class instead of actor for all reference types?