Replies: 1 comment 1 reply
-
If the commented out code is accurate then you are missing the primary associated types on the protocol: -var body: some ReducerProtocol {
+var body: some ReducerProtocol<State, Action> { Ideally we would have a way to tell Swift to autocomplete var body: some ReducerProtocol<<#State#>, <#Action#>> ...but unfortunately that is not possible. We also wanted to ship a helper so that you can write the var body: some ReducerProtocolOf<Self> ...but that typealias breaks the Xcode editor currently, and so we are holding off until that is fixed. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'll start with: I'm probably Doing It Wrong.
Xcode Version 14.0 (14A309), macOS application.
I just switched my app over to try the ReducerProtocol, because that looks so much cleaner. Couldn't wait. And, sure enough, now my code base is smaller, tidier, easier to scan, and I'm very happy. Except.
I have a couple of cases where feature reducers won't compile when I define their
var body: some ReducerProtocol
instead offunc reduce(...)
, and I'm not at all sure why.At the top level, my app reducer compiles just fine:
Farther down, though, I have a couple of features which each have sub-features (the edit & view population, which each open up to edit/view person). All the other features are implemented using the
reduce(into...
function, but when I try using thebody
builder implementation for these two, the compiler says, "Nope, you aren't implementingReducerProtocol
." Thus:So, what am I doing wrong? Please?
Beta Was this translation helpful? Give feedback.
All reactions