How to update actor properties from the main actor
Use static properties to allow your app to alter or update an actor's property within the main actor.
If you attempt to update the property of an actor that is not a main actor in a UIView, outside a Task or within a Task Xcode will alert you with the following error:
- Actor-isolated property can not be mutated from the main actor.
This can be resolved by making the actor's property static, enabling it to be updated on the main thread or within a task as if it were a normal property whilst keeping the remaining actor properties and functionality outside of the main thread.
Looking to learn more about things you can do with Swift and XCode ?
Search our blog to find educational content on learning how to use Swift and XCode.
Any Questions?
We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.