5 iOS Libraries to Animate Your App

A cool parallax view, animated page control, dynamic buttons, and more

Domenico Nicoli
Nov 15 · 3 min read
Photo by Przemyslaw Marczynski on Unsplash

1. TVButton

Today, we start with TVButton, a library that recreates the beautiful parallax effect that you can see on Apple TV, on your UIButton control. The effect is triggered by a long press or dragging.

To use the parallax effect, you need at least two/three layers of images with the same dimensions. Below is an implementation example:

let bg = TVButtonLayer(image: UIImage(named: "TVBG.png")!)
let pattern = TVButtonLayer(image: UIImage(named: "TVBtnPattern.png")!)
let top = TVButtonLayer(image: UIImage(named: "TVbtnTop.png")!)
tvButton.layers = [background, pattern, top]

Then you can customize the parallax-effect intensity by changing the following property:

tvButton.parallaxIntensity = 1.3

2. TKRubberIndicator

TKRubberIndicator is a library made in Swift that’ll add a rubber animated page control onto your app.

To use it, you need to import the TKRubberPageControl framework first. Then, you need to add the following code into your controller:

override func viewDidLoad() {
super.viewDidLoad()

page.center = self.view.center
page.valueChange = {(num) -> Void in
print("Closure : Page is \(num)")
}
page.addTarget(self, action: "targetActionValueChange:", forControlEvents: UIControlEvents.ValueChanged)
self.view.addSubview(page)

page.numberOfpage = 2
}

@IBAction func pageCountChange(sender: UISegmentedControl) {
page.numberOfpage = (sender.selectedSegmentIndex + 1) * 2
}
func targetActionValueChange(page:TKRubberIndicator){
print("Target-Action : Page is \(page.currentIndex)")
}

3. DimensionsPickerView

In a few lines of code, DimensionsPickerView will let you add a beautiful view that can be used to measure data input.

Placeholder unit, font color, spacing, and border color/width are customizable in the following way:

sizePickerView.textFieldConfigureBlock = { index, field in
switch index {
case 0:
field.placeholder = "w"
case 1:
field.placeholder = "h"
default:
break
}
}

sizePickerView.pickerFieldConfigureBlock = { field in
field.text = "m"
}

sizePickerView.tintColor = UIColor.red
sizePickerView.spacingBetweenValueFields = 0
sizePickerView.spacingBetweenUnitAndValues = 30

sizePickerView.layer.cornerRadius = 5
sizePickerView.layer.borderColor = UIColor.white.cgColor
sizePickerView.layer.borderWidth = 1.5

4. TransitionButton

TransitionButton is a library used to add a UIButton with loading and transition animations.

First of all, consider that TransitionButton is a subclass of UIButton. TransitionButton also adds two main methods:

  • startAnimation(): when called will start animating the button with a loading spinner
  • stopAnimation(...): when called will stop animating the button

5. Sliders

Lastly, Sliders is a library made entirely in SwiftUI. It allows you to create customizable horizontal and vertical sliders on iOS, macOS, and Mac Catalyst.

Among the personalizations, we find:

Better Programming

Advice for programmers.

Domenico Nicoli

Written by

Backend Developer (C#, VB.NET, Microsoft SQL Server), iOS developer (Swift). Parma, Italy 🇮🇹 https://linkedin.com/in/domenico-nicoli-5738ba15a

Better Programming

Advice for programmers.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade