PropertyAnimator

public final class PropertyAnimator<Target, Value> where Target: AnyObject, Value: VectorConvertible

Manages the application of animations to a property of type Value on the target object.

Property animators retain the target object, so they should not be used to animate properties of self.

let view = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))

let sizeAnimator = PropertyAnimator(target: view, keyPath: \.bounds.size)

/// Spring physics will move the view's size to the new value.
sizeAnimator.spring(to: CGSize(width: 300, height: 300))

/// Some time in the future...

/// The value will keep the same velocity that it had from the preceeding
/// animation, and a decay function will slowly bring movement to a stop.
sizeAnimator.decay(drag: 2.0)