-
In some places, I have code that reacts to something outside the scope of a view store. In these cases, I need to send an action to the store, so I'll in-line a new Is there a "better" way to send an action to the store in these contexts? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
What you are doing is the recommended way. We even have soft deprecated the idea of observing “stateless” stores just to get access to sending actions: |
Beta Was this translation helpful? Give feedback.
-
I take this to mean that ViewStores are both very lightweight so we don't need to worry about creating them, and also that creating lots of copies of the "same" ViewStore won't e.g. confuse SwiftUI? But I do wonder, what is wrong with the stateless version? Wouldn't that just be exactly the same thing, but with even less overhead? |
Beta Was this translation helpful? Give feedback.
What you are doing is the recommended way. We even have soft deprecated the idea of observing “stateless” stores just to get access to sending actions:
swift-composable-architecture/Sources/ComposableArchitecture/SwiftUI/WithViewStore.swift
Line 695 in bcae29f