Would it make sense for the reducer closure to be marked as @MainActor? #1272
Replies: 1 comment 8 replies
-
Hi @danyf90, it is true that currently reducers are only meant to be run on the main thread, but marking it explicitly as So, someday in the future we could make reducers As an aside, I'm curious what APIs you are using in the reducer that are marked as |
Beta Was this translation helpful? Give feedback.
-
Hello 👋
Given the reducer usually runs on the main thread, would it make sense to make the reducer closure
@MainActor
, or at least have the possibility to chose whether it needs to be a@MainActor
or not?Right now you can't access other non-async
@MainActor
s directly in the reducer code because you would need toawait
for it, but if the reducer itself would be a@MainActor
it wouldn't need to await to access another@MainActor
, right?Thank you 🙏
Beta Was this translation helpful? Give feedback.
All reactions