@Binding in App structure not updating view

Hi, I have this code in my (App).swift file and it passes an @Binding variable into my ContentView. The problem is that it doesn’t update in the content view. Thanks in advance!

  • It would help to show the ContentView…

Add a Comment

Replies

This pattern is not recommended with didSet subscribe to their changes instead. The patterns in the code don't follow the SwiftUI paradigm.

@State var whatsNew = Array<String>() {
        didSet {
            print("what's new array set, newRefreshIndicator = \(newRefreshIndicator)")
            newRefreshIndicator = false
            if !newPopup {
                newPopup = true
            }
        }
    }

@Binding var setMock: [Restaurants] {
        didSet {
            print("dataSet")
//            yes.restList.removeAll()
            joining = false
            print("searchRest = \(search)")
            print("mock = \(restMock)")
            search = true
            creating = false
            joining = false
        }
    }
  • This is irrelevant and actually crucial

Add a Comment