A custom UIControl which functions like UISlider where you can set multiple intervals with different step values for each interval.

Related tags

UI MultiStepSlider
Overview

Version License Documents

MultiStepSlider

A custom UIControl which functions like UISlider where you can set multiple intervals with different step values for each interval. This is useful when an interval spans over large values, for example, price of real estates. In that case it is convenient to divide the large interval in smaller intervals with each interval having its own step value.

#Installation

Add following lines in your pod file if you are using Swift 3

pod ‘MultiStepSlider’, '~> 2.0'

Add following lines in your pod file for previous Swift versions

pod ‘MultiStepSlider’, '~> 1.4'

#Usage

import ‘MultiStepSlider’

In interface builder, drag one UIView and set its class as MultiStepSlider.

Configuration

MultiStepSlider can be configured by the following method.

func configureSlider(intervals intervals: [Interval], preSelectedRange: RangeValue?)

The first parameter is an array of type Interval which is defined as:

 public struct Interval {
	public private(set) var min: Float = 0.0
	public private(set) var max: Float = 0.0
	public private(set) var stepValue: Float = 0.0
 }

The second parameter is of type RangeValue which is defined as:

 public struct RangeValue {
	public var lower: Float = 0.0
	public var upper: Float = 0.0
 }

This dictates the initial positions for lower and upper thumb. The lower and upper of RangeValue should lie within the interval specified and should be a valid node value. For example, if the there is an interval Interval(min: 50000, max: 100000, stepValue: 10000), then 60000 will be a valid node, but not 65000. In that case, a warning will be shown.

Warning: Range contains invalid node

Example

@IBOutlet weak var slider: MultiStepRangeSlider!
override func viewDidLoad() {
super.viewDidLoad()
let intervals = [Interval(min: 50000, max: 100000, stepValue: 10000),
Interval(min: 100000, max: 1000000, stepValue: 100000),
Interval(min: 1000000, max: 3000000, stepValue: 500000)]
let preSelectedRange = RangeValue(lower: 80000, upper: 500000)
slider.configureSlider(intervals: intervals, preSelectedRange: preSelectedRange)
print("continuous: lower = \(slider.continuousCurrentValues.lower) higher = \(slider.continuousCurrentValues.upper)")
print("discrete: lower = \(slider.discreteCurrentValue.lower) higher = \(slider.discreteCurrentValue.upper)")
}

Properties

discreteCurrentValue

This is of type RangeValue and gives the discrete upper and lower value.

continuousCurrentValue

This is of type RangeValue and gives the continuous upper and lower value.

trackTintColor

This color is used to tint the part of the track which is outside the range of lower thumb and upper thumb.

The default color is lightGrayColor.

trackHighlightTintColor

The color used to tint the part of the track which is inside the range of lowerValue and upperValue.

The default color is #007AFF (rgba = 0, 122, 255, 1)

trackCurvaceousness

This property is used to control the curvature of ends of the track. The property can have value from 0 to 1.

trackCurvaceousness = 0.0

trackCurvaceousness = 1.0

thumbCurvaceousness

This property is used to control the curvature of the thumbs. The property can have value from 0 to 1.

trackCurvaceousness = 0.5

trackCurvaceousness = 1.0

shadowEnabled

Setting this property as true will show shadow around the thumbs.

License

MultiStepSlider is available under the MIT License.

Reference

https://github.com/warchimede/RangeSlider/

You might also like...
A nice iOS View Capture Swift Library which can capture all content.
A nice iOS View Capture Swift Library which can capture all content.

SwViewCapture A nice iOS View Capture Library which can capture all content. SwViewCapture could convert all content of UIWebView to a UIImage. 一个用起来还

Advanced List View for SwiftUI with pagination & different states

AdvancedList This package provides a wrapper view around the SwiftUI List view which adds pagination (through my ListPagination package) and an empty,

Demonstrate the toolbar view modifier for SwiftUI with different placements
Demonstrate the toolbar view modifier for SwiftUI with different placements

ToolbarProject Demonstrate the toolbar view modifier for SwiftUI with different placements Youtube tutorial -- https://youtu.be/jTW5Z-kyL8g Use toolb

Bar Button Item that can be moved anywhere in the screen, like Android's stickers button.
Bar Button Item that can be moved anywhere in the screen, like Android's stickers button.

FlowBarButtonItem Bar Button Item that can be moved anywhere in the screen, like Android's stickers button. [![CI Status](http://img.shields.io/travis

List tree data souce to display hierachical data structures in lists-like way. It's UI agnostic, just like view-model and doesn't depend on UI framework
List tree data souce to display hierachical data structures in lists-like way. It's UI agnostic, just like view-model and doesn't depend on UI framework

SwiftListTreeDataSource List tree data souce to display hierachical data structures in lists-like way. It's UI agnostic, just like view-model, so can

UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images.
UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images.

MultiSelectSegmentedControl UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images. Feature

A SwiftUI Views for wrapping HStack elements into multiple lines
A SwiftUI Views for wrapping HStack elements into multiple lines

SwiftUI WrappingStack A SwiftUI Views for wrapping HStack elements into multiple lines. List of supported views WrappingHStack - provides HStack that

SheetPresentation for SwiftUI. Multiple devices support: iOS, watchOS, tvOS, macOS, macCatalyst.
SheetPresentation for SwiftUI. Multiple devices support: iOS, watchOS, tvOS, macOS, macCatalyst.

SheetPresentation for SwiftUI. Multiple devices support: iOS, watchOS, tvOS, macOS, macCatalyst.

A minimalistic looking banner library for iOS. It supports multiple customizable kinds of Banner types
A minimalistic looking banner library for iOS. It supports multiple customizable kinds of Banner types

A minimalistic looking banner library for iOS. It supports multiple customizable kinds of Banner types

Comments
  • Accessors or Getters

    Accessors or Getters

    I'm trying to make function that operates with these values but it's impossible to access them once set (if values are not some kind of global constants).

    Is it possible to add these getters for min, max and stepValue?

    opened by TheKvikk 1
  • Unable to install pod 1.4

    Unable to install pod 1.4

    I am not able to install ‘MultiStepSlider’, '~> 1.4' pod.

    i am running pod ‘MultiStepSlider’, '~> 1.4' in my terminal in my project folder directory.

    Getting below error: [!] Unable to satisfy the following requirements:

    • MultiStepSlider (~> 2.0) required by Podfile

    None of your spec sources contain a spec satisfying the dependency: MultiStepSlider (~> 2.0).

    opened by pankajW 3
  • Not working

    Not working

    Not working on Storyboards.

    2016-09-03 12:44:44.988 DMF[64902:2375215] Unknown class MultiStepRangeSlider in Interface Builder file.
    2016-09-03 12:44:44.989 DMF[64902:2375215] Failed to set (trackLayerHeight) user defined inspected property on (UIView): [<UIView 0x7feede04cde0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key trackLayerHeight.
    2016-09-03 12:44:44.990 DMF[64902:2375215] Failed to set (trackTintColor) user defined inspected property on (UIView): [<UIView 0x7feede04cde0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key trackTintColor.
    2016-09-03 12:44:44.990 DMF[64902:2375215] Failed to set (trackHighlightTintColor) user defined inspected property on (UIView): [<UIView 0x7feede04cde0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key trackHighlightTintColor.
    2016-09-03 12:44:44.990 DMF[64902:2375215] Failed to set (trackCurvaceousness) user defined inspected property on (UIView): [<UIView 0x7feede04cde0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key trackCurvaceousness.
    2016-09-03 12:44:44.990 DMF[64902:2375215] Failed to set (thumbSize) user defined inspected property on (UIView): [<UIView 0x7feede04cde0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key thumbSize.
    2016-09-03 12:44:44.991 DMF[64902:2375215] Failed to set (thumbTintColor) user defined inspected property on (UIView): [<UIView 0x7feede04cde0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key thumbTintColor.
    2016-09-03 12:44:44.991 DMF[64902:2375215] Failed to set (shadowEnabled) user defined inspected property on (UIView): [<UIView 0x7feede04cde0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key shadowEnabled.
    2016-09-03 12:44:44.991 DMF[64902:2375215] Failed to set (thumbCurvaceousness) user defined inspected property on (UIView): [<UIView 0x7feede04cde0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key thumbCurvaceousness.
    

    And cannot manually instantiate it given the fact that ALL properties are private inside this POD.

    opened by mradzinski 1
Owner
Susmita Horrow
Susmita Horrow
Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView.

StepProgressView Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView. Usage let progr

Yonat Sharon 340 Dec 16, 2022
RangeSeedSlider provides a customizable range slider like a UISlider.

RangeSeekSlider Overview RangeSeekSlider provides a customizable range slider like a UISlider. This library is based on TomThorpe/TTRangeSlider (Objec

WorldDownTown 644 Dec 12, 2022
A UIControl subclass that makes it easy to create empty states.

AZEmptyState Making empty state simple. Screenshots Installation Cocoa Pods: pod 'AZEmptyState' Manual: Simply drag and drop the Sources folder to you

Antonio Zaitoun 88 Oct 2, 2022
Handy UIControl subclasses. (Think Three20/NimbusKit of UIControls.)

STAControls STAControls is a collection of classes that aim to make dealing with Cocoa's UIControl subclasses more convenient, and to reduce the compl

Aaron 12 Oct 30, 2019
Full configurable spreadsheet view user interfaces for iOS applications. With this framework, you can easily create complex layouts like schedule, gantt chart or timetable as if you are using Excel.

kishikawakatsumi/SpreadsheetView has moved! It is being actively maintained at bannzai/SpreadsheetView. This fork was created when the project was mov

Kishikawa Katsumi 34 Sep 26, 2022
A little app which shows different ways to simulate NSPanel using NSWindow

FunWithPanels A little app which shows different ways to simulate NSPanel using NSWindow, for better or worse. Settings FunWithPanels uses a combinati

Mitchell Cohen 7 Aug 3, 2022
Pull up controller with multiple sticky points like in iOS Maps

PullUpController Create your own pull up controller with multiple sticky points like in iOS Maps Features Multiple sticky points Landscape support Scr

Mario Iannotta 1.2k Dec 22, 2022
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.

Zhouqi Mo 3.3k Dec 21, 2022
You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.

PullToDismiss PullToDismiss provides dismiss modal viewcontroller function like Facebook Messenger by pulling scrollview or navigationbar with smooth

Suguru Kishimoto 479 Dec 5, 2022