Skip to content

Instantly share code, notes, and snippets.

@aswathr
aswathr / ZoomInOutOnTapModifier.swift
Last active September 7, 2022 15:16
ZoomInOutOnTapModifier
//Button scaling animation test
//Supporting GIST for https://stackoverflow.com/a/73637703/3970488
import SwiftUI
import PlaygroundSupport
/// An animatable modifier that is used for observing animations for a given animatable value.
public struct AnimationCompletionObserverModifier<Value>: AnimatableModifier where Value: VectorArithmetic {
/// While animating, SwiftUI changes the old input value to the new target value using this property. This value is set to the old value until the animation completes.
public var animatableData: Value {
@aswathr
aswathr / alphanumericComparison.swift
Last active June 8, 2022 12:51
Alphanumeric comparison in swift
// "b" > "a"
// "3" > "1"
// "ac" > "ab"
// "32" > "25"
// "abcd1" > "abc2"
// "abc123a" > "abc2a"
// "abc123a" < "abc1234a"
// "abc123" < "abc123a"
// "abc12a49" > "abc12a39"
// "123ab3" = "123ab3"