A lightweight 3D Linear Carousel with parallax effect
TGLParallaxCarousel is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "TGLParallaxCarousel"-
Place one UIView object in your VC in the Storyboard and set it as subclass of
TGLParallaxCarousel -
Create an IBOutlet in your VC.swift file, connect it a connect delegate and datasource.
@IBOutlet weak var carouselView: TGLParallaxCarousel!
override func viewDidLoad() {
super.viewDidLoad()
carouselView.delegate = self
carouselView.itemMargin = 10
}- Conform to delegate
// MARK: - TGLParallaxCarouselDelegate
extension ViewController: TGLParallaxCarouselDelegate {
func numberOfItemsInCarouselView(carouselView: TGLParallaxCarousel) -> Int {
return 5
}
func carouselView(carouselView: TGLParallaxCarousel, itemForRowAtIndex index: Int) -> TGLParallaxCarouselItem {
return CustomView(frame: CGRectMake(0, 0, 300, 150), number: index)
}
func carouselView(carouselView: TGLParallaxCarousel, didSelectItemAtIndex index: Int) {
print("Tap on item at index \(index)")
}
func carouselView(carouselView: TGLParallaxCarousel, willDisplayItem item: TGLParallaxCarouselItem, forIndex index: Int) {
print("")
}
}- Enjoy!
taglia3, the.taglia3@gmail.com
TGLParallaxCarousel is available under the MIT license. See the LICENSE file for more info.

