diff --git a/Spring/Extensions.swift b/Spring/Extensions.swift new file mode 100644 index 0000000..fc02df2 --- /dev/null +++ b/Spring/Extensions.swift @@ -0,0 +1,18 @@ + +import UIKit + +// Extension on Springable protocol that conforms to UIView (UIButton, UILabel, ...) +extension Springable where Self: UIView { + + /** + Setup your animation preset and curve. + - Parameters: + - preset: The animation you want to play (`.ZoomIn`, `.ZoomOut`, `.FadeIn`, ...). + - curve: The curve you want to apply to your animation (`.EaseIn`, `.EaseOut`, ...). + - Important: This function only setup preset and curve animation you have to animate it using `yourUIView.animate()` for exemple. + */ + func animation(preset: Spring.AnimationPreset, curve: Spring.AnimationCurve) { + self.animation = preset.rawValue + self.curve = curve.rawValue + } +} diff --git a/Spring/Extensions.swift alias b/Spring/Extensions.swift alias new file mode 100644 index 0000000..de6ded0 Binary files /dev/null and b/Spring/Extensions.swift alias differ