peegee
1
I have a manager class that updates the UI with a combine publisher. I would like to use @MainActor to make the class thread safe. It has several long running async methods that would cause responsiveness issues if run from the main actor. Is there a way to make sure those methods run in the background while the rest of the class is isolated to the main actor?
Jon_Shier
(Jon Shier)
2
Mark them as nonisolated.
1 Like
I would recommend moving these methods to a separate actor type. This way you'd also follow separation of concerns principle, assuming you move associated state to that separate actor.
7 Likes