-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
Description
This is related to following discussion #3162
Currently in my project, have to run in release mode on local device while developing.
Sample code to reproduce the issue
import ComposableArchitecture
import SwiftUI
@main
struct TheComposablePathApp: App {
@Bindable var store = Store(initialState: Application.State(), reducer: Application.init)
var body: some Scene {
WindowGroup {
NavigationStack(
path: $store.scope(state: \.path, action: \.path),
root: {
RootView(store: store.scope(state: \.rootState, action: \.root))
},
destination: { store in
switch store.case {
case .child(let store):
ChildView(store: store)
default:
EmptyView()
}
}
)
}
}
}
@Reducer
public struct Application {
@ObservableState
public struct State: Equatable {
internal var rootState = Root.State()
internal var path = StackState<Path.State>()
public init() {
}
}
public enum Action {
case path(StackAction<Path.State, Path.Action>)
case root(Root.Action)
case removeElement
}
public init() {
}
@Dependency(\.continuousClock) var clock
public var body: some ReducerOf<Self> {
Reduce {
state, action in
switch action {
case .path(.element(let id, action: .child(.drop))):
return .none
case .path(.element(let id, action: .child(.push))):
state.path.append(.child(Child.State(number: state.path.ids.count)))
return .none
case .root(.push):
state.path.append(.child(Child.State(number: state.path.ids.count)))
return .none
case .removeElement:
let removed = state.path.ids[state.path.ids.count - 2]
guard let index = state.path.ids.firstIndex(of: removed) else {
return .none
}
state.path.removeSubrange(index...index)
return .none
case .path:
return .none
case .root:
return .none
}
}
._printChanges()
.forEach(\.path, action: \.path)
Scope(state: \.rootState, action: \.root) {
Root()
}
}
@Reducer(state: .equatable)
public enum Path {
case child(Child)
case child2(Child)
case child3(Child)
case child4(Child)
case child5(Child)
case child6(Child)
case child7(Child)
case child8(Child)
case child9(Child)
case child10(Child)
case child11(Child)
case child12(Child)
case child13(Child)
case child14(Child)
case child15(Child)
case child16(Child)
case child17(Child)
case child18(Child)
case child19(Child)
case child110(Child)
case child21(Child)
case child22(Child)
case child23(Child)
case child24(Child)
case child25(Child)
case child26(Child)
case child27(Child)
case child28(Child)
case child29(Child)
case child210(Child)
case child31(Child)
case child32(Child)
case child33(Child)
case child34(Child)
case child35(Child)
case child36(Child)
case child37(Child)
case child38(Child)
case child39(Child)
case child310(Child)
case child41(Child)
case child42(Child)
case child43(Child)
case child44(Child)
case child45(Child)
case child46(Child)
case child47(Child)
case child48(Child)
case child49(Child)
case child410(Child)
case featureCat(FeatureCat)
case featureDog(FeatureDog)
case featureFish(FeatureFish)
case featureBird(FeatureBird)
case featureTree(FeatureTree)
case featureLeaf(FeatureLeaf)
case featureStar(FeatureStar)
case featureMoon(FeatureMoon)
case featureSun(FeatureSun)
case featureSky(FeatureSky)
case featureHill(FeatureHill)
case featureRock(FeatureRock)
case featureRiver(FeatureRiver)
case featureLake(FeatureLake)
case featureBoat(FeatureBoat)
case featureShip(FeatureShip)
case featureWave(FeatureWave)
case featureWind(FeatureWind)
case featureRain(FeatureRain)
case featureSnow(FeatureSnow)
case featureCloud(FeatureCloud)
case featureStorm(FeatureStorm)
case featureFog(FeatureFog)
case featureMist(FeatureMist)
case featureDew(FeatureDew)
case featureFrost(FeatureFrost)
case featureIce(FeatureIce)
case featureFire(FeatureFire)
case featureAsh(FeatureAsh)
case featureEmber(FeatureEmber)
case featureFlame(FeatureFlame)
case featureGlow(FeatureGlow)
case featureSpark(FeatureSpark)
case featureBolt(FeatureBolt)
case featureFlash(FeatureFlash)
case featureBlaze(FeatureBlaze)
case featureLava(FeatureLava)
case featureSmoke(FeatureSmoke)
case featureSteam(FeatureSteam)
case featureSand(FeatureSand)
case featureClay(FeatureClay)
case featureStone(FeatureStone)
case featureGem(FeatureGem)
case featureJewel(FeatureJewel)
case featureGold(FeatureGold)
case featureIron(FeatureIron)
case featureCopper(FeatureCopper)
case featureBronze(FeatureBronze)
case featureSilver(FeatureSilver)
case featurePlatinum(FeaturePlatinum)
case featureMercury(FeatureMercury)
case featureZinc(FeatureZinc)
case featureBrass(FeatureBrass)
case featureSteel(FeatureSteel)
case featureTin(FeatureTin)
}
}
@Reducer
public struct Root {
public struct State: Equatable {
public init() {
}
}
public enum Action {
case push
}
public init() {
}
public var body: some ReducerOf<Self> {
Reduce {
state, action in
switch action {
case .push:
return .none
}
}
}
}
public struct RootView: View {
private let store: StoreOf<Root>
public init(store: StoreOf<Root>) {
self.store = store
}
public var body: some View {
Button(action: { store.send(.push) }, label: {
Text("Push")
})
}
}
import ComposableArchitecture
@Reducer
public struct Child {
@ObservableState
public struct State: Equatable {
let number: Int
public init(number: Int) {
self.number = number
}
}
public enum Action {
case drop
case push
}
public init() {
}
public var body: some ReducerOf<Self> {
Reduce {
state, action in
switch action {
case .drop:
return .none
case .push:
return .none
}
}
}
}
import ComposableArchitecture
import SwiftUI
public struct ChildView: View {
private let store: StoreOf<Child>
public init(store: StoreOf<Child>) {
self.store = store
}
public var body: some View {
VStack {
Text(String(describing: store.number))
Button(action: { store.send(.push) }, label: {
Text("Push")
})
Button(action: { store.send(.drop) }, label: {
Text("Drop")
})
}
}
}
@Reducer
public struct FeatureOne {
}
public struct FeatureOneView: View {
public var body: some View {
Text("FeatureViewOne")
}
}
@Reducer
public struct FeatureCat {
}
@Reducer
public struct FeatureDog {
}
@Reducer
public struct FeatureFish {
}
@Reducer
public struct FeatureBird {
}
@Reducer
public struct FeatureTree {
}
@Reducer
public struct FeatureLeaf {
}
@Reducer
public struct FeatureStar {
}
@Reducer
public struct FeatureMoon {
}
@Reducer
public struct FeatureSun {
}
@Reducer
public struct FeatureSky {
}
@Reducer
public struct FeatureHill {
}
@Reducer
public struct FeatureRock {
}
@Reducer
public struct FeatureRiver {
}
@Reducer
public struct FeatureLake {
}
@Reducer
public struct FeatureBoat {
}
@Reducer
public struct FeatureShip {
}
@Reducer
public struct FeatureWave {
}
@Reducer
public struct FeatureWind {
}
@Reducer
public struct FeatureRain {
}
@Reducer
public struct FeatureSnow {
}
@Reducer
public struct FeatureCloud {
}
@Reducer
public struct FeatureStorm {
}
@Reducer
public struct FeatureFog {
}
@Reducer
public struct FeatureMist {
}
@Reducer
public struct FeatureDew {
}
@Reducer
public struct FeatureFrost {
}
@Reducer
public struct FeatureIce {
}
@Reducer
public struct FeatureFire {
}
@Reducer
public struct FeatureAsh {
}
@Reducer
public struct FeatureEmber {
}
@Reducer
public struct FeatureFlame {
}
@Reducer
public struct FeatureGlow {
}
@Reducer
public struct FeatureSpark {
}
@Reducer
public struct FeatureBolt {
}
@Reducer
public struct FeatureFlash {
}
@Reducer
public struct FeatureBlaze {
}
@Reducer
public struct FeatureLava {
}
@Reducer
public struct FeatureSmoke {
}
@Reducer
public struct FeatureSteam {
}
@Reducer
public struct FeatureSand {
}
@Reducer
public struct FeatureClay {
}
@Reducer
public struct FeatureStone {
}
@Reducer
public struct FeatureGem {
}
@Reducer
public struct FeatureJewel {
}
@Reducer
public struct FeatureGold {
}
@Reducer
public struct FeatureIron {
}
@Reducer
public struct FeatureCopper {
}
@Reducer
public struct FeatureBronze {
}
@Reducer
public struct FeatureSilver {
}
@Reducer
public struct FeaturePlatinum {
}
@Reducer
public struct FeatureMercury {
}
@Reducer
public struct FeatureZinc {
}
@Reducer
public struct FeatureBrass {
}
@Reducer
public struct FeatureSteel {
}
@Reducer
public struct FeatureTin {
}
Checklist
- I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
- If possible, I've reproduced the issue using the
mainbranch of this package. - This issue hasn't been addressed in an existing GitHub issue or discussion.
Expected behavior
No response
Actual behavior
No response
Steps to reproduce
No response
The Composable Architecture version information
1.11.2
Destination operating system
17.5.1
Xcode version information
15.4
Swift Compiler version information
No response
Metadata
Metadata
Assignees
Labels
No labels