Skip to content

yashthaker7/NumberPicker

Repository files navigation

NumberPicker

Version License Platform

A more interactive way to display and select number.

Installation

NumberPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'NumberPicker'

How to use

Call this function in action.

func openNumberPicker() {
    let numberPicker = NumberPicker(delegate: self, maxNumber: 300) // set max number 
    numberPicker.bgGradients = [.red, .yellow]
    numberPicker.tintColor = .white
    numberPicker.heading = "Weight"
    numberPicker.defaultSelectedNumber = 150 // set default selected number

    self.present(numberPicker, animated: true, completion: nil)
}

Customize

You can change gradient color and tint color and title

    numberPicker.bgGradients = [.red, .yellow]
    numberPicker.tintColor = .white
    numberPicker.heading = "Weight"

Delegate

extension ViewController: NumberPickerDelegate {

    func selectedNumber(_ number: Int) {
        print(number)
    }
}

Author

Yash Thaker, yashthaker7@gmail.com

License

NumberPicker is available under the MIT license. See the LICENSE file for more info.