Skip to content

Getting Runtime warning on setting optional state nil only if the view is wrapped inside navigation #1901

Discussion options

You must be logged in to vote

Hey @kakhaberikiknadze! TextField is indeed a very vocal view that frequently over-emits on its binding. For example, it sets the the value when it loses focus, and this is very likely what you're observing when FeatureB is dismissed: FeatureB.State is nil'd, the view goes away, and if the TextField had focus, it emits on the binding when losing it, which triggers the warning because FeatureB.State is nil. There are experiments to disable this warning when the action is a BindingAction, but it would only work when using the BindingReducer. It is also possible that this warning can also be bypassed if the upcoming navigation utilities are used.

I didn't run your code, so I can't explain ye…

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
7 replies
@kakhaberikiknadze
Comment options

@kakhaberikiknadze
Comment options

@kakhaberikiknadze
Comment options

@tgrapperon
Comment options

@kakhaberikiknadze
Comment options

Answer selected by kakhaberikiknadze
Comment options

You must be logged in to vote
3 replies
@miaoruiyuan
Comment options

@miaoruiyuan
Comment options

@miaoruiyuan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants