Created
May 27, 2025 02:33
-
-
Save abhi21git/6ce5dffe75013a3171bab2e2d4aa8fb2 to your computer and use it in GitHub Desktop.
This code replicated iOS 18 lock screen clock text change animation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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