• Stars
    star
    104
  • Rank 330,604 (Top 7 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Custom number picker

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, [email protected]

License

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