Swift UI : Conditional view

Swift UI refresh problem

Defining a list of MenuItems in a View.
I want to make a version where only the favorite MenuItems are displayed.
Therefor I defined a bool for favorite selection.
(Remark : I deleted all unneeded fields to make the problem clear)

Using the ObservedObject / Published wrappers

I see it working because the value of the switch is correctly updated in the view, but the line is not disapearing.

Schermafbeelding 2020-10-15 om 11.23.26

Schermafbeelding 2020-10-15 om 11.28.42

Initial state
Filter works fine because on line 1 and 2 are shown.

After update the list shows the wrong result : Line 1 should not be on the list.
Favorite bool is on false => No Value

Schermafbeelding 2020-10-15 om 11.22.17

Xcode Version : 12.0.1
Catalina Version : 10.15.6

This topic was automatically closed after 166 days. New replies are no longer allowed.