KGVibratingView — Simple framework to shake/Vibrate the iOS View objects

ANANTHA KRISHNAN K G
Swift Dynamics
Published in
2 min readMay 18, 2017

--

Custom animations are pretty interesting in iOS. Its always a must to give better UI animations to the end user and iOS apps are pretty good at this. There are so many ways we can add animations to the UIView objects in Swift. I always wondered how to create a Shaker/Vibrating animation for UI elements in iOS. Nourishing this thought in my mind, last weekend I decided to give it a try .

The KGVibratingView is a simple framework that will give vibrating or shaking animation to the UIView objects in your iOS application. It is pretty simple to use and code also i kept simple (I believe so 😁).

To use this framework you can either use Cocoapods or download the file directly from gitHub

  1. To use pods add the following in your pod file,
use_frameworks!pod 'KGVibratingView'

2 . Now do a pod install

3. Open the project and add the KGVibratingView animation to the UIView object. For example.

@IBAction func touched(_ sender: UIButton) {
sender.startShakingWith(direction: .Vertical_Top, numberOfTimes: 140, totalDuration: 5, completion: nil)

}

This is it . You will be able to see the animation on the view element.

That’s it folks. Thanks for reading and supporting me…. !!!!! 😊 ❤️

--

--