TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Roy Marmelstein.
Recreating the cool parallax icons from Apple TV as iOS UIButtons (in Swift). The effect is triggered by long pressing or dragging.
Import TVButton at the top of your Swift ViewController.
import TVButton
Create and position your TVButton in interface builder or in code.
For the parallax TVButton you will need at least two layers of images (three recommended). For best results, the button and the images should all have the same dimensions. Assign the relevant UIImages to TVButtonLayers and provide them as a layers array to the TVButton.
let background = TVButtonLayer(image: UIImage(named: "TVButtonBackground.png")!)
let pattern = TVButtonLayer(image: UIImage(named: "TVButtonPattern.png")!)
let top = TVButtonLayer(image: UIImage(named: "TVButtonTop.png")!)
tvButton.layers = [background, pattern, top]
You can customize the parallax intensity of your TVButton. Default value is 1.0 and it’s very subtle. Maximum recommended value is 2.0.
tvButton.parallaxIntensity = 1.3
Enjoy!