Skip to content

Instantly share code, notes, and snippets.

@Drag0ndust
Created October 11, 2022 08:08
Show Gist options
  • Save Drag0ndust/2ab8e0a2568c156beb7ee2ffc7f284f3 to your computer and use it in GitHub Desktop.
Save Drag0ndust/2ab8e0a2568c156beb7ee2ffc7f284f3 to your computer and use it in GitHub Desktop.
iOS 16: Bottom Sheet
struct MyBottomSheet: View {
@State private var showSheet = false
var body: some View {
ZStack {
Color.green
.ignoresSafeArea()
Button {
showSheet.toggle()
} label: {
Text("Show sheet")
.accentColor(.white)
}
}
.sheet(isPresented: $showSheet) {
ZStack {
Color.blue
Text("My awesome sheet")
}
.background(Color.blue)
// .presentationDetents([.medium, .large])
// .presentationDetents([.height(100)])
// .presentationDetents([.fraction(0.3)])
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment