Skip to content

Instantly share code, notes, and snippets.

@Edudjr
Created October 23, 2022 18:55
Show Gist options
  • Save Edudjr/cbc07d8fc50c10f11f14742e0760d1d3 to your computer and use it in GitHub Desktop.
Save Edudjr/cbc07d8fc50c10f11f14742e0760d1d3 to your computer and use it in GitHub Desktop.
struct AnimationSample: View {
@State var firstAnimation = false
@State var secondAnimation = false
@State var displaySheet = false
var body: some View {
Text("Testing")
.scaleEffect(firstAnimation ? 2 : 1)
.foregroundColor(secondAnimation ? .red : .green)
.onTapGesture {
withAnimation(.linear(duration: 0.5)) {
firstAnimation = true
}
withAnimation(.linear(duration: 0.5).delay(0.5)) {
secondAnimation = true
displaySheet = true
}
}
.sheet(isPresented: $displaySheet) {
Text("Another view!")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment