A library to simplify iOS animations in Swift.

Last update: May 15, 2022

Updated for Swift 4.2

Requires Xcode 10 and Swift 4.2.

Installation

Drop in the Spring folder to your Xcode project (make sure to enable "Copy items if needed" and "Create groups").

Or via CocoaPods:

use_frameworks!
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git'

Usage with Storyboard

In Identity Inspector, connect the UIView to SpringView Class and set the animation properties in Attribute Inspector.

Usage with Code

layer.animation = "squeezeDown"
layer.animate()

Demo The Animations

Chaining Animations

layer.y = -50
animateToNext {
  layer.animation = "fall"
  layer.animateTo()
}

Functions

animate()
animateNext { ... }
animateTo()
animateToNext { ... }

Animation

shake
pop
morph
squeeze
wobble
swing
flipX
flipY
fall
squeezeLeft
squeezeRight
squeezeDown
squeezeUp
slideLeft
slideRight
slideDown
slideUp
fadeIn
fadeOut
fadeInLeft
fadeInRight
fadeInDown
fadeInUp
zoomIn
zoomOut
flash

Curve

spring
linear
easeIn
easeOut
easeInOut

Properties

force
duration
delay
damping
velocity
repeatCount
scale
x
y
rotate

* Not all properties work together. Play with the demo app.

Autostart

Allows you to animate without code. Don't need to use this if you plan to start the animation in code.

Autohide

Saves you the hassle of adding a line "layer.alpha = 0" in viewDidLoad().

Known issue

Animations won't autostart when view is reached via performSegueWithIdentifier.

Tutorials

ChangeLog

License

Spring is released under the MIT license. See LICENSE for details.

GitHub

https://github.com/MengTo/Spring
Comments
  • 1. Animation doesn't work when the View Controller is pushed through Navigation Controller.

    I have tested this by creating a test project and applying animation to UIButtons. The root view controller's button animates while the UIButton in next view controller(which is pushed after first button is pressed) does not animate. Both buttons have same SpringButton properties.

    I am trying to animating through storyboard.

    Reviewed by RishabhTayal at 2015-02-24 18:11
  • 2. Carthage support

    Supporting Cocoapods (http://cocoapods.org) and/or Carthage (https://github.com/Carthage/Carthage) is great for libraries. It might not be the easiest thing for "new comers", but for the rest is a must

    Reviewed by raulriera at 2015-02-01 12:40
  • 3. setValue:forUndefinedKey

    2015-03-03 19:55:52.507 demos[24988:4604020] Failed to set (animation) user defined inspected property on (UIView): [<UIView 0x7a8860b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key animation.
    
    
    Reviewed by aliencode at 2015-03-03 11:56
  • 4. CGBlendMode.Type' does not have a member named 'Normal'

    I'm currently running Swift 2, with Xcode 7 and using the swift2 branch of Spring. Upon building the project I am given this error

    /Desktop/Swift/Dynamic/Pods/Spring/Spring/DesignableTabBarController.swift:110:40: 'CGBlendMode.Type' does not have a member named 'Normal'
    

    Any ideas? I've already tried building and cleaning.

    Reviewed by ghost at 2015-07-03 20:44
  • 5. is unavailable: cannot find Swift declaration for this class

    Hi,

    When I building my app in simulator, everything is working, but when I want to build app on device I get errors that different Spring classes declarations cannot been found, can you help me?

    Reviewed by IcooN at 2015-02-15 02:44
  • 6. Back button does not nothing

    I'm starting the Tutorial from your book but I've imported the Spring framework to the project and when I've set the segue to "unwindToViewController" and Run the project, the Back button does nothing....Please help me ;) Regards,

    Álvaro.

    Reviewed by alvagorn at 2015-03-21 16:12
  • 7. Swift Compiler Error

    Didn't have this problem last night. Not sure what cause this? Help, please.

    /Spring-master/Spring/LoadingView.swift /Spring-master/Spring/LoadingView.swift:40:99: 'AnyObject' is not convertible to 'UIView'; did you mean to use 'as!' to force downcast? /Spring-master/Spring/Misc.swift /Spring-master/Spring/Misc.swift:26:37: 'countElements' has been renamed to count /Spring-master/Spring/Misc.swift:75:21: 'countElements' has been renamed to count /Spring-master/Spring/DesignableTabBarController.swift /Spring-master/Spring/DesignableTabBarController.swift:36:35: 'selectedImageTintColor' was deprecated in iOS version 8.0: Use tintColor /Spring-master/Spring/DesignableTabBarController.swift:49:46: '?' must be followed by a call, member lookup, or subscript /Spring-master/Spring/DesignableTabBarController.swift:50:53: '[AnyObject]?' is not convertible to '[UITabBarItem]'; did you mean to use 'as!' to force downcast? /Spring-master/Spring/DesignableTabBarController.swift:58:47: '?' must be followed by a call, member lookup, or subscript /Spring-master/Spring/DesignableTabBarController.swift:59:53: '[AnyObject]?' is not convertible to '[UITabBarItem]'; did you mean to use 'as!' to force downcast? /Spring-master/Spring/DesignableTabBarController.swift:67:46: '?' must be followed by a call, member lookup, or subscript /Spring-master/Spring/DesignableTabBarController.swift:68:53: '[AnyObject]?' is not convertible to '[UITabBarItem]'; did you mean to use 'as!' to force downcast? /Spring-master/Spring/DesignableTabBarController.swift:76:47: '?' must be followed by a call, member lookup, or subscript /Spring-master/Spring/DesignableTabBarController.swift:77:53: '[AnyObject]?' is not convertible to '[UITabBarItem]'; did you mean to use 'as!' to force downcast? /Spring-master/Spring/DesignableTabBarController.swift:85:46: '?' must be followed by a call, member lookup, or subscript /Spring-master/Spring/DesignableTabBarController.swift:86:53: '[AnyObject]?' is not convertible to '[UITabBarItem]'; did you mean to use 'as!' to force downcast? /Spring-master/Spring/DesignableTabBarController.swift:95:39: '[AnyObject]?' is not convertible to '[UITabBarItem]'; did you mean to use 'as!' to force downcast? /Spring-master/Spring/Spring.swift /Spring-master/Spring/Spring.swift:450:35: Missing argument label 'completion:' in call

    Reviewed by ajthechan at 2015-04-09 19:14
  • 8. Designable: Build Fail

    I just bought your book and going through v1. Great job, and so far so good.

    I do have an issue with Spring though. I've installed through dragging it into xCode and have checked both "copy files if required" and "create group". But, when I try to use it, it says Designable: Build Fail. I've tried your test SpringApp, and it worked, but not for my own app that I'm building. Any idea?

    @MengTo

    Reviewed by ervintwj at 2017-10-12 20:38
  • 9. SpringAnimation for OC lover

    Reason

    The SpringAnimation.swift doesn't support for objective-c.

    Resolution

    Create a OC model that have same function as SpringAnimation.

    I bought the book BTW :DDD

    Reviewed by LawrenceHan at 2015-07-28 08:53
  • 10. LoadingView.xib missing?

    I'm using CocoaPods to integrate Spring, but the app crashes when calling view.showLoading( ): "Could not load NIB in bundle...with name 'LoadingView'"

    Could this be because LoadingView.xib is not included in the podspec? I'm new to CocoaPods, but the podspec has: "s.source_files = 'Spring/.swift' " -- should there also be: ",.xib" ?

    Thanks

    Reviewed by frizzy75 at 2015-03-25 23:04
  • 11. prevents retain cycle

    based on what I said here:

    https://github.com/MengTo/Spring/issues/16

    The views were retaining the Spring, and the Spring was also retaining the view.

    Reviewed by camovb at 2015-02-02 23:10
  • 12. Feature/easy animation

    I added a no-fuss convenience method for animating any Springable adhering object - just by specifying the animation type as a parameter instead of first needing to set the .animation property as a string. It includes an optional completion handler and a basic test.

    I am not sure if this project is still maintained but as I used this for my project I thought I would pull-request it. Cheers!

    Reviewed by jjvarghese at 2021-06-19 18:43
  • 13. Fix redundant `public` statements and prefer `let` over `var`

    This should resolve unnecessary compiler warnings over "reduntant public declaration" or "use let instead of var for non-mutating variables".

    Reviewed by Sebastian-Hojas at 2020-05-09 12:23
Related tags
A Swift library to take the power of UIView.animateWithDuration(_:, animations:...) to a whole new level - layers, springs, chain-able animations and mixing view and layer animations together!
A Swift library to take the power of UIView.animateWithDuration(_:, animations:...) to a whole new level - layers, springs, chain-able animations and mixing view and layer animations together!

ver 2.0 NB! Breaking changes in 2.0 - due to a lot of requests EasyAnimation does NOT automatically install itself when imported. You need to enable i

May 6, 2022
(Animate CSS) animations for iOS. An easy to use library of iOS animations. As easy to use as an easy thing.
(Animate CSS) animations for iOS. An easy to use library of iOS animations. As easy to use as an easy thing.

wobbly See Wobbly in action (examples) Add a drop of honey ?? to your project wobbly has a bunch of cool, fun, and easy to use iOS animations for you

Dec 23, 2021
A collection of animations for iOS. Simple, just add water animations.
A collection of animations for iOS. Simple, just add water animations.

DCAnimationKit A collection of animations for iOS Simply, just add water! DCAnimationKit is a category on UIView to make animations easy to perform. E

Apr 14, 2022
An iOS library to natively render After Effects vector animations
An iOS library to natively render After Effects vector animations

Lottie for iOS, macOS (and Android and React Native) View documentation, FAQ, help, examples, and more at airbnb.io/lottie Lottie is a mobile library

May 22, 2022
A library of custom iOS View Controller Animations and Interactions.
A library of custom iOS View Controller Animations and Interactions.

RZTransitions is a library to help make iOS7 custom View Controller transitions slick and simple. Installation CocoaPods (Recommended) Add the followi

Apr 28, 2022
Swift library for choreographing animations on the screen.
Swift library for choreographing animations on the screen.

Spruce iOS Animation Library (and Android) What is it? Spruce is a lightweight animation library that helps choreograph the animations on the screen.

May 16, 2022
SamuraiTransition is an open source Swift based library providing a collection of ViewController transitions featuring a number of neat “cutting” animations.
SamuraiTransition is an open source Swift based library providing a collection of ViewController transitions featuring a number of neat “cutting” animations.

SamuraiTransiton is a ViewController transition framework in Swift. It is an animation as if Samurai cut out the screen with a sword. transition types

Apr 11, 2022
Physics-based animations for iOS, tvOS, and macOS.

Advance An animation library for iOS, tvOS, and macOS that uses physics-based animations (including springs) to power interactions that move and respo

May 15, 2022
Sample way of integrating animations into a design system for iOS app projects.

Animations in Design System The project presents a sample way of integrating animations into a design system for iOS developers. Project setup A sampl

Nov 26, 2021
Easily build advanced custom animations on iOS.
Easily build advanced custom animations on iOS.

INTUAnimationEngine makes it easy to build advanced custom animations on iOS. INTUAnimationEngine provides a friendly interface to drive custom animat

May 22, 2022
MotionBlur allows you to add motion blur effect to iOS animations.
MotionBlur allows you to add motion blur effect to iOS animations.

MotionBlur MotionBlur allows you to add motion blur effect to your animations (currently only position's change). See the accompanying blog post to le

Apr 22, 2022
Swift interpolation for gesture-driven animations
Swift interpolation for gesture-driven animations

Interpolate Interpolate is a powerful Swift interpolation framework for creating interactive gesture-driven animations. Usage The ?? idea of Interpola

May 17, 2022
Composable animations in Swift

Composable animations in Swift. Blog Installation Cocoapods The easiest way to get started is to use CocoaPods. Just add the following line to your Po

Jan 12, 2022
Easy to read and write chainable animations in Objective-C and Swift
Easy to read and write chainable animations in Objective-C and Swift

Whats new in version 3.x? Swiftier syntax Swift 4 support Bug fixes and improvements Whats new in version 2.x? Re-architected from the ground up, no m

May 19, 2022
⛓ Easy to Read and Write Multi-chain Animations Lib in Objective-C and Swift.
⛓ Easy to Read and Write Multi-chain Animations Lib in Objective-C and Swift.

中文介绍 This project is inspired by JHChainableAnimations! Why Choose LSAnimator & CoreAnimator? You can write complex and easy-to-maintain animations in

May 12, 2022
Declarative chainable animations in Swift
Declarative chainable animations in Swift

Wave Declarative chainable animations in Swift ❤️ Support my apps ❤️ Push Hero - pure Swift native macOS application to test push notifications PasteP

Mar 5, 2022
Ease is an event driven animation system that combines the observer pattern with custom spring animations as observers
Ease is an event driven animation system that combines the observer pattern with custom spring animations as observers

Ease is an event driven animation system that combines the observer pattern with custom spring animations as observers. It's magic. Features Animate a

May 8, 2022
Advanced Natural Motion Animations, Simple Blocks Based Syntax
Advanced Natural Motion Animations, Simple Blocks Based Syntax

FlightAnimator Moved to Swift 3.1 Support: For Swift 3.1 - Use tag Version 0.9.9 See Installation Instructions for clarification Introduction FlightAn

Feb 8, 2022
A UICollectionViewLayout subclass that adds custom transitions/animations to the UICollectionView without effecting your existing code.
A UICollectionViewLayout subclass that adds custom transitions/animations to the UICollectionView without effecting your existing code.

AnimatedCollectionViewLayout Normally a UICollectionView has no transition effects when you scroll from one item to another. There are lots of ways to

May 23, 2022