Skip to content

Instantly share code, notes, and snippets.

@Volorf
Last active March 22, 2024 11:46
Show Gist options
  • Save Volorf/81ae055938d72e903beb572fedf45bbf to your computer and use it in GitHub Desktop.
Save Volorf/81ae055938d72e903beb572fedf45bbf to your computer and use it in GitHub Desktop.
Text Animation.swift
import SwiftUI
import PlaygroundSupport
struct MyExperimentalView: View
{
@State private var count: Int = 10
var body: some View
{
Text("Count: \(count)")
.onTapGesture(count: 1)
{
count -= 1
print(count)
}
.contentTransition(.numericText(value: Double(count)))
.animation(.bouncy, value: count)
}
}
let view = MyExperimentalView()
PlaygroundPage.current.setLiveView(view)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment