Post

Replies

Boosts

Views

Activity

Reply to fullScreenCover not dismissed if binding changes rapidly.
Although I abandoned the approach, I did eventually found a solution: Instead of a custom Binding, you should use a @State var showOverlay and listen for changes to your fast-changing state variable via view.onChange(of: fastChangingStateVariable) { value in showOverlay = value == true } or view.onReceive(), if it's a published variable. @State private var showFullscreenOverlay = false // ... private func onStateVariableChange(_ stateVariable: SomeType) { self.showFullscreenOverlay = stateVariable == 0 // or so } // ... var body: some View { // ... .onChange(of: fastChangingStateVariable, perform: onStateVariableChange) .fullscreenCover(isPresented: $showFullscreenOverlay) { MyOverlay() } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’25