Skip to content

Horizontal and Vertical range picker for height/weight selection

License

Notifications You must be signed in to change notification settings

mobven/RangePicker

Repository files navigation

SwiftPM compatible

UI Component to display items in UIPickerView based on range selection.

RangePicker

Enhance the user experience by using a RangePicker.

RangePicker Docs describe how to integrate the framework.

Gifs

iphone14pro iphone14pro

Requirements

  • iOS 11.0+
  • Xcode 14+
  • Swift 5.8+

Installation

RangePickerView is distributed via Swift Package Manager which is the only official distribution tool by Apple. You can add RangePickerView to your project from Xcode's File > Swift Packages > Add Package Dependency menu with its github URL:

https://github.com/mobven/RangePicker.git

Usage

UIStoryboard

import RangePicker
@IBOutlet var rangePickerView: RangePickerView!

Programmatically

let rangePickerView = RangePickerView()
rangePickerView.delegate = self
rangePickerView.range = (minimum: 100, maximum: 200)
self.view.addSubviews(rangePickerView)

Customization

You can easily customize the RangePicker with editing Configuration properties.

Property Type Description
alignment RangePickerView.Alignment The value for vertical or horizontal.
range Int The minimum and maximum value for selection.
valueType String The type of value to select. (Kg, cm etc.)
visibilityRange Int The range of elements to display.
selectedIndex Int A zero-indexed number identifying selection of the range picker view.
selectRow Int Select row of the picker view.
seperatorBackgroundColor UIColor The background color of the separator view.
valueFont UIFont The font for the value label's text.
valueTextColor UIColor The text color for the value label's text.
unitFont UIFont The font for the unit label's text.
unitTextColor UIColor The text color for the unit label's text.
Example

You can customize properties like this,

  rangePickerView.alignment = .horizontal
  rangePickerView.valueType = "kg"

What's next

  • [] SwiftUI representable code example.
  • [] Unit Tests.
  • [] Update value and unit label during active scrolling gesture.

Developed with 🖤 at Mobven for MAC+