Created
September 21, 2022 14:56
-
-
Save sanzaru/ba9fd8e8726fb658e89e9da729dd3dd4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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