Skip to content

Instantly share code, notes, and snippets.

@ekurutepe
Last active October 26, 2022 14:31
Show Gist options
  • Save ekurutepe/a65fde8851335502ecd2b04b0367abaa to your computer and use it in GitHub Desktop.
Save ekurutepe/a65fde8851335502ecd2b04b0367abaa to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
@State private var showSheetView = false
var body: some View {
VStack(spacing: 0) {
topBar
Color.blue
}
.sheet(isPresented: $showSheetView) {
SheetView()
}
}
private var topBar: some View {
HStack(spacing: 0) {
Spacer()
Button {
showSheetView = true
} label: {
Text("Sheet")
.padding()
.background(Color.red)
}
}
}
}
struct SheetView: View {
var body: some View {
Color.green
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
@ekurutepe
Copy link
Author

  • Tap "Sheet"
  • Background the app for a few seconds
  • Open the app again
  • Dismiss sheet
  • Notice how the tap area for the Button is shifted down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment