Skip to content

Instantly share code, notes, and snippets.

@abhi21git
Created May 27, 2025 02:33
Show Gist options
  • Save abhi21git/6ce5dffe75013a3171bab2e2d4aa8fb2 to your computer and use it in GitHub Desktop.
Save abhi21git/6ce5dffe75013a3171bab2e2d4aa8fb2 to your computer and use it in GitHub Desktop.
This code replicated iOS 18 lock screen clock text change animation.
extension View {
@ViewBuilder
func numericTransition(_ value: Double) -> some View {
if #available(iOS 17.0, *) {
contentTransition(.numericText(value: value))
.animation(.easeInOut(duration: 0.3), value: value)
} else {
transition(.opacity)
.animation(.easeInOut(duration: 0.2), value: value)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment