/CarouselButtons

iOS Code - Carousel Buttons Library

Primary LanguageSwiftMIT LicenseMIT

CarouselButtons

This library gives you a carousel of buttons to be used in your projects.

Swift Version License

Build Status

This CarouselButtons library helps you to have a carousel of buttons.

Features

  • Add icon and title for your button.
  • Choose the initial state.
  • Add action when the buttton is selected.

Requirements

  • Xcode 12.x
  • Swift 5.x

Installation

CocoaPods

You can use CocoaPods to install CarouselButtons by adding it to your Podfile:

platform :ios, '15.0'
use_frameworks!
pod 'CarouselButtons', :git => 'https://github.com/TeloTechnology/CarouselButtons.git', :tag => '1.0.2'

Import after installation

To get the full benefits import CarouselButtons.

import CarouselButtons

Manually

  1. Download and drop CarouselButtons folder in your project.
  2. Congratulations!

Usage example

  1. Set the height to 126px via code or GUI.

  2. Add the code below.

@IBOutlet
private weak var carouselCollectionButton: CarouselCollectionView!

let data = [
    (title: "Cash", icon: UIImage(named: "CashMoney"), isAvailable: true),
    (title: "Credit Card", icon: UIImage(named: "CreditCard"), isAvailable: true),
    (title: "Wallet 1", icon: UIImage(named: "Wallet"), isAvailable: false),
    (title: "Wallet 2", icon: UIImage(named: "Wallet"), isAvailable: true)
]

carouselCollectionButton.add(data)

carouselCollectionButton.didSelectButton = { position in
    print("Did select at: \(position) with title: \(data[position].title")
}

Check the demo project.

Contribute

We would love you for the contribution to CarouselButtons, please create a Pull Request.

Meta

Rudi Luis – @Linkedin

Telo Technology Limited – @Website