Carousel

The carousel component allows a series of content to cycle horizontally.

Backpack/Carousel

Cocoapods class reference view on Github

Default

Day Night

Usage

BPKCarousel displays a collection of views in a horizontal scrollable list. It is designed to be used with UIImageView "cells".

let carousel = BPKCarousel()
carousel.set(images: [
    UIImageView(image: UIImage(named: "image1")),
    UIImageView(image: UIImage(named: "image2"))
])

To get notified when the user scrolls to a new page, set the delegate property.

let carousel = BPKCarousel()
carousel.delegate = MyCarouselDelegate()

class MyCarouselDelegate: BPKCarouselDelegate {
    func onImageChange(index: Int) {
        print("User scrolled to page \(index)")
    }
}