import SwiftUI extension Binding { func isPresent() -> Binding where Value == Wrapped? { .init( get: { self.wrappedValue != nil }, set: { isPresent, transaction in guard !isPresent else { return } self.transaction(transaction).wrappedValue = nil } ) } }