MengTo / Spring

A library to simplify iOS animations in Swift.
http://designcode.io
MIT License
14.08k stars 1.8k forks source link

Animating a UIView custom subclass #186

Open otymartin opened 8 years ago

otymartin commented 8 years ago

@MengTo @jamztang I want to animate this CircleCounter UIView to shake when touched. How can I do it with Spring? https://github.com/johngraham262/JWGCircleCounter

el12n commented 7 years ago

Create a custom view that Extends from CircleCounter UIView and then implement Springable delegate methods to make all spring animation in the view.

For example to animate a Switch I've created SpringSwitch like this:

    open class SpringSwitch: UISwitch, Springable {
        @IBInspectable public var autostart: Bool = false
        ...
    }

You can even add all IBInspectable properties, just like the other SpringViews.

otymartin commented 7 years ago

@el12n Thanks man