Closed BrentMifsud closed 2 months ago
Until this is solved, a work around is to mark the init as nonisolated
.
This should be ok for viewmodel as you would not expect to do anything that would require mainactor
and if you did you could always create a task to run on the main actor.
The rest of the method on the viewmodel will still be protected by the main actor and called form SwiftUi view, which automatically run the body function in main actor isolation.
这是来自QQ邮箱的自动回复邮件。 邮件已收到
Until this is solved, a work around is to mark the init as
nonisolated
.This should be ok for viewmodel as you would not expect to do anything that would require
mainactor
and if you did you could always create a task to run on the main actor.The rest of the method on the viewmodel will still be protected by the main actor and called form SwiftUi view, which automatically run the body function in main actor isolation.
This wouldn't work if you were working with an observable object for example.
You might want to compute the initial values of your published properties in the init which wouldn't be possible to do in a nonisolated context.
Cleanse is now deprecated. Please read the deprecation notice on the README for next steps. Thank you!
With Swift 6 on the horizon, this library is going become quite painful to use.
Already today I am facing tons of actor isolation related compiler errors.
Are there any plans to address this?
for example: