Code Monkey home page Code Monkey logo

singlelineshakeanimation's Introduction

SingleLineShakeAnimation

TLDR; Shake a view with a single line of code with a non-intrusive extension for UIView, written in Swift.

With this non-intrusive UIView extension, your UIView subclasses can get shaking with very little code. Shaking can be useful to indicate an important action your user needs to perform, for example filling out a form before submitting. Show the user it by gently shaking the needed view to get their attention.

Version License Carthage compatible

Installation

pod "SingleLineShakeAnimation"

Usage

import library

import SingleLineShakeAnimation
Basic horizontal shake
button.shake(.Horizontal)
Basic vertical shake
button.shake(.Vertical)

Using the default values, 5 times back and forth, animating for 0.5 seconds.

Example

Resize Example

Customized usage

Vertical shake with completion block.

button.shake(.Vertical, completion: { 
            // do something after animation finishes
        })

Stating number of times to go back and forth and total duration for the whole animation to take.

button.shake(.Horizontal, numberOfTimes: 10, totalDuration: 0.6, completion: {
            // do something after animation finishes
        })

Author

Håkon Bogen, [email protected]

License

SingleLineShakeAnimation is available under the MIT license. See the LICENSE file for more info.

Single Line APIs

Really good APIs should not need more than a single line of code to work and be as non intrusive as possible. This library is a part of my ongoing effort to build single line libraries for iOS. Check out the other ones on the list as well.

singlelineshakeanimation's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.