Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select preset and curve animation with enum value #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Spring/Extensions.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
Binary file added Spring/Extensions.swift alias
Binary file not shown.