Hello I hope you guys having a nice start of the week.
I have a problem with bindings.
I would like to show a cover view depending on the optional child state. And in the child state I have a text binding. But the problem is when the keyboard is visible and I tap close button (setting the optional state to nil in this case) prints out and error in the console.
This is generally considered an application logic error, and can happen for a few reasons:
• A parent reducer set child state to "nil" before this reducer ran. This reducer must run before any other reducer sets child state to "nil". This ensures that child reducers can handle their actions while their state is still available.
• An in-flight effect emitted this action when child state was "nil". While it may be perfectly reasonable to ignore this action, consider canceling the associated effect before child state becomes "nil", especially if it is a long-living effect.
• This action was sent to the store while state was "nil". Make sure that actions for this reducer can only be sent from a view store when state is non-"nil". In SwiftUI applications, use "IfLetStore".
2022-11-21 18:03:08.298698+0100 OptinalChildStateProblem[88762:12894750] [ComposableArchitecture] A binding action sent from a view store at "OptinalChildStateProblem/ContentView.swift:50" was not handled. …
Action:
OptionalDomain.Action.binding(.set(_, ))
To fix this, invoke "BindingReducer()" from your feature reducer's "body".
This is a sample project to demonstrate the problem.
Anybody have any idea how to fix it or should I just ignore it since it seems like a reasonable case.