Skip to content

Instantly share code, notes, and snippets.

@sanzaru
Created September 21, 2022 14:56
Show Gist options
  • Save sanzaru/ba9fd8e8726fb658e89e9da729dd3dd4 to your computer and use it in GitHub Desktop.
Save sanzaru/ba9fd8e8726fb658e89e9da729dd3dd4 to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
@State private var showSheet = false
var body: some View {
ZStack {
Button(
action: { showSheet = true },
label: {
HStack {
Image(systemName: "square.and.arrow.up")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Toggle sheet")
}
}
)
.disabled(showSheet)
}
.padding()
.sheet(isPresented: $showSheet) {
NavigationView {
Text("Sheet Content")
.toolbar {
ToolbarItem {
Button("Done") { showSheet = false }
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment