Skip to content

denwakeup/swift-interactive-dismiss-modal

Repository files navigation

Swift Interactive Dismiss Modal

Usage

import SwiftInteractiveDismissModal

struct ContentView: View {
    @State var isPresented = false
    @State var canDismissSheet = false

    var body: some View {
        Button("Tap me") {
            isPresented = true
        }
        .sheet(
            isPresented: $isPresented,
            content: {
                NavigationView {
                    Text("Hello World")
                }
                .interactiveDismiss(canDismissSheet: canDismissSheet) {
                    print("attemptToDismissHandler")
                }
            }
        )
    }
}

About

Prevent dismissal of modal(sheet) in SwiftUI

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages