Skip to content

Instantly share code, notes, and snippets.

View abhi21git's full-sized avatar
:octocat:

Abhishek Maurya abhi21git

:octocat:
View GitHub Profile
extension String {
subscript(_ i: Int) -> Character {
self[index(startIndex, offsetBy: i)]
}
}
@abhi21git
abhi21git / NumericTransion.swift
Created May 27, 2025 02:33
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)
}