Skip to content

Instantly share code, notes, and snippets.

@VAndrJ
Created November 6, 2024 15:43
Show Gist options
  • Save VAndrJ/a96869b173da323748ea9b9eb3504be1 to your computer and use it in GitHub Desktop.
Save VAndrJ/a96869b173da323748ea9b9eb3504be1 to your computer and use it in GitHub Desktop.
interactiveDismissDisabled issue.
import SwiftUI
struct ContentView: View {
@State private var isSheetPresented = false
var body: some View {
NavigationStack {
Button("Present sheet") {
isSheetPresented = true
}
.sheet(isPresented: $isSheetPresented) {
DismissMeSheetView()
}
}
}
}
struct DismissMeSheetView: View {
@Environment(\.dismiss) private var dismiss
var body: some View {
NavigationStack {
NavigationLink("Next") {
Text("Dismiss me interactively")
.toolbar {
ToolbarItem {
Button("Dismiss") {
dismiss()
}
}
}
.interactiveDismissDisabled()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment