Description
In the Your First Feature tutorial (and probably others), the given code doesn't compile due to a lack of satisfying the conformance to Reducer. I don't know if it's written this way intentionally so I didn't make a pull request to update it. However, I was able to get it compile by copying similar (but different) code from the Getting Started guide.
Checklist
Expected behavior
The code should compile
Actual behavior
Received the error: Type 'CounterFeature' does not conform to protocol 'Reducer' without further explanation of what doesn't conform, and no "fix it" to add stubs.
Reproducing project
import ComposableArchitecture
@Reducer
struct CounterFeature {
@ObservableState
struct State {
var count = 0
}
enum Action {
case decrementButtonTapped
case incrementButtonTapped
}
- // Does not compile
- var body: some ReducerOf<Self> {
+ // Compiles
+ var body: some Reducer<State, Action>
Reduce { state, action in
switch action {
case .decrementButtonTapped:
state.count -= 1
return .none
case .incrementButtonTapped:
state.count += 1
return .none
}
}
}
}
The Composable Architecture version information
1.20.2
Destination operating system
MacOS 15.5
Xcode version information
Version 26.0 beta 4
Swift Compiler version information
6.2 (whatever the defaults of the project are)
Description
In the Your First Feature tutorial (and probably others), the given code doesn't compile due to a lack of satisfying the conformance to Reducer. I don't know if it's written this way intentionally so I didn't make a pull request to update it. However, I was able to get it compile by copying similar (but different) code from the Getting Started guide.
Checklist
mainbranch of this package.Expected behavior
The code should compile
Actual behavior
Received the error:
Type 'CounterFeature' does not conform to protocol 'Reducer'without further explanation of what doesn't conform, and no "fix it" to add stubs.Reproducing project
import ComposableArchitecture @Reducer struct CounterFeature { @ObservableState struct State { var count = 0 } enum Action { case decrementButtonTapped case incrementButtonTapped } - // Does not compile - var body: some ReducerOf<Self> { + // Compiles + var body: some Reducer<State, Action> Reduce { state, action in switch action { case .decrementButtonTapped: state.count -= 1 return .none case .incrementButtonTapped: state.count += 1 return .none } } } }The Composable Architecture version information
1.20.2
Destination operating system
MacOS 15.5
Xcode version information
Version 26.0 beta 4
Swift Compiler version information
6.2 (whatever the defaults of the project are)