Skip to content

Mildwhale/SteppableSlider

Repository files navigation

SteppableSlider

SteppableSlider is a custom UISlider that provides step.

image

Features

  • RxSwift is supported.
  • Support Haptic feedback on .valueChanged.

Usage

You can use SteppableSlider with code or storyboard. Its fully compatible for interface builder.

Swift

import SteppableSlider

let slider = SteppableSlider()
slider.numberOfSteps = 4
slider.addTarget(self, action: #selector(sliderValueChanged(_:)), for: .valueChanged)

@objc func sliderValueChanged(_ sender: SteppableSlider) {
    print(sender.currentStepIndex) // 0 ~ 3
}

RxSwift

import RxSteppableSlider

let slider = SteppableSlider()
slider.numberOfSteps = 4

slider.rx.currentIndex
    .subscribe(onNext: { [weak self] index in
        print(index) // 0 ~ 3
    })
    .disposed(by: disposeBag)

Installation

CocoaPods

pod 'SteppableSlider', '~> 0.1.1'

or 

pod 'SteppableSlider/RxSwift', '~> 0.1.1'

Swift Package Manager

https://github.com/Mildwhale/SteppableSlider.git

or

dependencies: [
    .package(url: "https://github.com/Mildwhale/SteppableSlider.git")
]

Requirements

  • iOS 10.0+
  • Swift 4+