-
I'm attempting to switch screens based on different cases of an enum Reducer. The implementation works perfectly on the simulator, but when I run the same code on an actual device (specifically, an iPhone Xs running iOS 16), the screen transitions do not occur. The issue seems to be related to the view rendering part, as the received action logs indicate the state changes as expected but the screen does not update accordingly. Below is a version of my code and the debug log showing the state transition @Reducer(state: .equatable)
enum ClinicalAdhd {
case splash(Splash)
case login(Login)
case main(Main)
static var body: some ReducerOf<Self> {
Reduce { state, action in
switch action {
case .splash(.done):
state = .login(Login.State())
return .none
case .splash(.main):
state = .main(Main.State())
return .none
// Other cases omitted for brevity
}
}
.ifCaseLet(\.splash, action: \.splash) {
Splash()
}
.ifCaseLet(\.login, action: \.login) {
Login()
}
.ifCaseLet(\.main, action: \.main) {
Main()
}
}
}
struct AppView: View {
@Perception.Bindable var store: StoreOf<ClinicalAdhd>
init(store: StoreOf<ClinicalAdhd>) {
self.store = store
}
var body: some View {
WithPerceptionTracking {
switch store.case {
case let .splash(store):
SplashView(store: store)
case let .login(store):
LoginView(store: store)
case let .main(store):
MainView(store: store)
}
}
}
} I've checked for any obvious differences between the simulator and device environments, but everything seems identical. Could there be any specific reasons why this issue occurs on the device but not on the simulator? What steps can I take to diagnose and resolve this issue? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @imhans, are you running an iOS 16 simulator too? And can you provide a minimal project that reproduces the problem so that we can investigate? |
Beta Was this translation helpful? Give feedback.
Hi @imhans, are you running an iOS 16 simulator too? And can you provide a minimal project that reproduces the problem so that we can investigate?