Skip to content

Instantly share code, notes, and snippets.

@alpennec
Last active November 18, 2022 18:04
Show Gist options
  • Save alpennec/4a794d793ce3cab03c194fccf9e91740 to your computer and use it in GitHub Desktop.
Save alpennec/4a794d793ce3cab03c194fccf9e91740 to your computer and use it in GitHub Desktop.
For Christian
import SwiftUI
struct ContentView: View {
@State var show: Bool = false
var body: some View {
ZStack {
Button {
withAnimation(.easeInOut(duration: 3)) {
show.toggle()
}
} label: {
Text("Show")
}
GeometryReader { proxy in
ZStack(alignment: .bottom) {
Color.clear
if show {
Text("Hello once upon a time there was a duck named Ducky who went on to drink lots of juice boxes and live happily ever after")
.padding()
.padding(.bottom, proxy.safeAreaInsets.bottom)
.background(
Color.green
.cornerRadius(20.0)
)
.frame(maxWidth: .infinity)
.transition(.move(edge: .bottom))
}
}
.ignoresSafeArea()
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment