Giter Site home page Giter Site logo

rangeseekslider's Introduction

RangeSeekSlider

Join the chat at https://gitter.im/WorldDownTown/RangeSeekSlider

License Language Carthage compatible CocoaPods compatible Downloads with CocoaPods Awesome

Overview

RangeSeekSlider provides a customizable range slider like a UISlider. This library is based on TomThorpe/TTRangeSlider (Objective-C) and made with Swift.

demo

Demo

You can try on Appetize.io

or

Build Xcode project.

  1. Open RangeSeekSlider.xcodeproj.
  2. Change Scheme to RangeSeekSliderDemo
  3. Run

Usage

Add the RangeSeekSlider like you would with any other UIControl. Either:

  • Add a view in your storyboard/xib and change its Class and Module to RangeSeekSlider. You can set all the properties in the Attributes Inspector and see a live preview:

Interface Builder Module Screenshot

Interface Builder Screenshot

or

  • Create the RangeSeekSlider in code using RangeSeekSlider() then add it as a subview to your code and set the relevant autolayout properties or frame.

The default slider ranges from 0.0 -> 100.0 and has 10.0 preselected as the minimum, and 90.0 as the maximum.

Values that the user has selected are exposed using the selectedMinValue and selectedMaxValue properties. You can also use these properties to change the selected values programatically if you wish.

Other customisation of the control is done using the following properties:

tintColor

The tintColor property (which you can also set in Interface Builder) sets the overall color of the control, including the color of the line, the two handles, and the labels.

It is safe to change the tintColor at any time, if the control is currently visible the color change will be animated into the new color.

minValue

The minimum possible value to select in the range

maxValue

The maximum possible value to select in the range

selectedMinValue

The preselected minumum value (note: This should be less than the selectedMaxValue)

selectedMaxValue

The preselected maximum value (note: This should be greater than the selectedMinValue)

minLabelFont

The font of the minimum value text label. If not set, the default is system font size 12.0.

maxLabelFont

The font of the maximum value text label. If not set, the default is system font size 12.0.

numberFormatter

Each handle in the slider has a label above it showing the current selected value. If you change number format, update each properties of NumberFormatter. By default, this is displayed as a decimal format.

hideLabels

When set to true the labels above the slider controls will be hidden. Default is false.

labelsFixed

Fixes the labels above the slider controls. If true, labels will be fixed to both ends. Otherwise labels will move with the handles. Default is false.

minDistance

The minimum distance the two selected slider values must be apart. Default is 0.0.

maxDistance

The maximum distance the two selected slider values must be apart. Default is CGFloat.greatestFiniteMagnitude.

minLabelColor

The color of the minimum value text label. If not set, the default is the tintColor.

maxLabelColor

The color of the maximum value text label. If not set, the default is the tintColor.

handleColor

If set it will update the color of the handles. Default is tintColor.

colorBetweenHandles

The colorBetweenHandles property sets the color of the line between the two handles.

handleBorderColor

If set it will update the color of the handle borders. Default is tintColor.

initialColor

The color of the entire slider when the handle is set to the minimum value and the maximum value. Default is nil.

disableRange

If true, the control will mimic a normal slider and have only one handle rather than a range.

In this case, the selectedMinValue will be not functional anymore. Use selectedMaxValue instead to determine the value the user has selected.

enableStep

If true the control will snap to point at each step (property) between minValue and maxValue. Default value is disabled.

step

If enableStep is true, this controls the value of each step. E.g. if this value is 20, the control will snap to values 20,40,60...etc. Set this is you enable the enableStep property.

handleImage

If set the image passed will be used for the handles.

handleDiameter

If set it will update the size of the handles. Default is 16.0.

selectedHandleDiameterMultiplier

If set it update the scaling factor of the handle when selected. Default is 1.7. If you don't want any scaling, set it to 1.0.

lineHeight

Set the height of the line. It will automatically round the corners. If not specified, the default value will be 1.0.

handleBorderWidth

If set it will update the size of the handle borders. Default is 0.0

labelPadding

If set it will update the size of the padding between label and handle. Default is 8.0

minLabelAccessibilityLabel

The label displayed in accessibility mode for minimum value handler. If not set, the default is empty String.

maxLabelAccessibilityLabel

The label displayed in accessibility mode for maximum value handler. If not set, the default is empty String.

minLabelAccessibilityHint

The brief description displayed in accessibility mode for minimum value handler. If not set, the default is empty String.

maxLabelAccessibilityHint

The brief description displayed in accessibility mode for maximum value handler. If not set, the default is empty String.

func setupStyle()

When subclassing RangeSeekSlider and setting each item in setupStyle(), the design is reflected in Interface Builder as well. setup_style.gif

Requirements

  • Swift 3.0+
  • iOS 9.0+

Installation

Carthage

RangeSeekSlider is available through Carthage. To install it, simply add the following line to your Cartfile:

github "WorldDownTown/RangeSeekSlider"

⚠️Warning⚠️

When installed with Carthage, @IBDesignable can't be available (Carthage Issue). But we have a workaround is shown in Stack Overflow. It is able to use @IBDesignable by subclassing RangeSeekSlider.

@IBDesignable class CustomRangeSeekSlider: RangeSeekSlider {}

CocoaPods

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

pod 'RangeSeekSlider'

Manually

Download and drop RangeSeekSlider/Sources folder in your project.

Author

WorldDownTown, [email protected]

License

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

rangeseekslider's People

Contributors

gitter-badger avatar hernangonzalez avatar lisardo avatar readmecritic avatar saifsidedev avatar worlddowntown avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rangeseekslider's Issues

Handle border width & color not working

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

Setting handle border and color has no effect. Looks like its property is not even used in the code.

Environment

Just define a value for the border properties other than the color used for the handle itself.

Min label visible after setting *disableRange*

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

After setting the disableRange to true, minLabel still shows up. I guess the following line (469):

        minLabel.isHidden = hideLabels

Should read:

        minLabel.isHidden = hideLabels || disableRange

Let me know if that's the fix or I am using it wrong and I'll send a PR.

Thank you,
H.

Environment

Can't update Slider while inside TableView cell

Tried to refresh updated value in Slider not working. But the selectedMinValue and selectedMaxValue is updating, but the slider is not showing correct value.

I've tried different approaches to get the result. But nothing works.

It would be good, if we get a refreshSlider method inside RangeSeekSlider. Let me know, if there's any solutions for this ?

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

Environment

IB Designables: Failed to render and update auto layout status

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

The preview doesn't work in my XIB, and I'm getting this error in Xcode:

file:///Users/tommy/Git/spis/raclette-app/raclette-app/Shared/TableViewCells/PriceRangeCell/PriceRangeTableViewCell.xib: error: IB Designables: Failed to render and update auto layout status for PriceRangeTableViewCell (KGk-i7-Jjw): dlopen(RangeSeekSlider.framework, 1): no suitable image found.  Did find:
	RangeSeekSlider.framework: required code signature missing for 'RangeSeekSlider.framework'

Environment

  • Library version: 1.7.0
  • iOS version: 11.4
  • Swift version: 4

problem with step and min max value in disableRange mode

Screen Shot 2019-05-15 at 10 27 17 AM

I am facing problem with the step
I have set minValue to 1
maxValue to 10
step to 2

on running the app, when I move the slider from selected maxValue of 1, it reaches 2 which I think should be (1 +2 = 3). It reaches upto 10 which I think should not happen. (max 9)
on trying to decrease the value from 2 it won't reach 1 which is true considering the step but in the first hand 2 should never get selected.

drop shadow on handles

Thank you for this nice, useful component first
Now I wanna to drop shadow on handles but seems I can't do it.
I read the source of RangeSeekSlider, leftHandle and rightHandle both are private so I can't add layer by myself.
Would you add some properties for adding shadow?

Rx Extension with RxCocoa

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

I am trying to make the delegate reactive, in order doing so I use RxCocoa's DelegateProxy. One of the requirement is to make the protocol @objc because of the use of #selector. in This lib, you are using delegate extension to provide a default implementation which is not going to work with @objc.

@objc functions may not currently be in protocol extensions. You could create a base class instead, though that's not an ideal solution. [source](@objc functions may not currently be in protocol extensions. You could create a base class instead, though that's not an ideal solution.)

https://stackoverflow.com/a/39604189/2187976

My changes can be found here: https://github.com/alouanemed/RangeSeekSlider/blob/68a5f97823b44d047329f2811a33e65161851c97/Sources/RangeSeekSliderDelegate.swift

And yet, I am still getting the @objc error when used in my project.

How can we solve this?

Environment

  • Library version latest
  • iOS version 12
  • Swift version 5

Change label position

Issue Description

Hi, can I change the label position from bottom to top?

Environment

  • Library version: 1.8.0
  • iOS version: 13.4.1
  • Swift version: 5

Typo in ReadMe

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

the example code in Carthage section:

@IBDesignable class CustomRangeSeekSlider: RangeSeedSlider {}

should be

@IBDesignable class CustomRangeSeekSlider: RangeSeekSlider {}

Slider does not work with iOS 13 in a collection view

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

I am using the RangeSeekSlider in a project that uses iOS 12. The slider is embedded in a not expandable collection view cell. When updated to iOS 13 beta, the slider does not respond anymore. I tested it also with other iOS versions and it works as always.

Environment

iOS version: iOS 13 beta 6

RTL support

hi
i want min value be in right hand side and max value in left hand side
how can i do it?

Swift Package Manager Support

New Issue Checklist

  • [✓ ] Updated RangeSeekSlider to the latest version
  • [✓ ] Checked Gitter

Issue Description

Swift Package Manager is not working with Xcode 11.2.1. Steps: File->Swift Package Dependencies->Add...

Expected: package can be added
Actual: Package can't be added

Environment

Version 11.2.1 (11B500)

PR

#85

Slider does not slide when navigationController?.hidesBarsOnSwipe = true

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

I have a custom class that replaces the UIViewController class in order to create a custom navigation bar on every VC that inherits said class. In the viewDidLoad() I have navigationController?.hidesBarsOnSwipe = true which breaks the sliding function. Anyone else able to reproduce the issue?

Thanks!

Environment

Xcode 9

  • Library version: 1.8.0 swift 4 branch
  • iOS version: 11.1.2
  • Swift version: 4.0

range slider Vertical

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

Environment

hi how can change position rangeSlider to Vertical ??

Manually setup cause to crash

Hi, when I use via cocoapods ther is no problem but when I setup manually with dropping to folder direclty cause crash. It gives bad access.

Screen Shot 2019-12-18 at 11 44 08

Update needed for Swift 4.0

Issue Description

Swift compiler errors with size(attributes:) which is obsoleted in Swift 4.0
NSFontAttributeName also is obsoleted in Swift 4.0

Environment

  • Library version 1.7.0
  • iOS version 11.0
  • Swift version 4.0

Slider present value is not update

Slider present value is not update

if i write a code in viewdidload its working fine but if same code I call through any function slider Ui is not updated

Feature Request - I want to be able to update the currentValue ( min and max ) programatically

For now, we can only set the "Pre"selected max and min value. So if update that value again, the slider won't update. There should be a variable called currentMinValue and currentMaxValue that would update the slider programatically ( it is handy for multiple UI Updates coming from API calls and offline fetches ). And if you want some help with this, i can do it.

Thanks!

Update format of the minLabel & maxLabel

Hello there,
I would like to format the slider text (minimum label & maximum label) that are there on the left & right side.

Let me explain scenario.

I am making flight app where I am using this slider
I have filter where I need to select the duration
I have duration as 245 to 510 means 4 hrs 5 min to 8 hr 30 min. What I want to do is show 4 hrs 5 min instead of 245. Any idea how this customization can be done?
I can handle the logic, however I am unable to find a place where I can set text. I have a function ready which will convert integer (245) to string (4 hrs 5 min).

Missing CFBundleVersion

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

After adding this framework to our application, we are getting the following error when uploading to iTunes Connect (TestFlight beta):

[11:13:20]: [Transporter Error Output]: ERROR ITMS-90056: "This bundle Payload/XXXX.app/Frameworks/RangeSeekSlider.framework is invalid. The Info.plist file is missing the required key: CFBundleVersion."
[11:13:20]: Transporter transfer failed.
[11:13:20]: 
[11:13:20]: ERROR ITMS-90056: "This bundle Payload/XXXX.app/Frameworks/RangeSeekSlider.framework is invalid. The Info.plist file is missing the required key: CFBundleVersion."

Environment

  • Library version 1.7.0
  • iOS version 10-11
  • Swift version 4

Framework was installed via Carthage, adding the following to our Cartfile:

# Used for time sliders
github "WorldDownTown/RangeSeekSlider"

Urgent Issue

hello and thank you for the great library but i have problem i want ask if possible to set min thumb on the right side and max thumb on left side ?

Best Regards

Change the selected value programmatically

New Issue Checklist

  • Updated RangeSeekSlider to the latest version
  • Checked Gitter

Issue Description

I think this is more of a feature request than an issue.

I noticed that you can't programmatically change the min and max values after they've been set initially. It'll be nice if there is an option to do that.

I'm adding a demo project here just in case. It has a slider with min value being 0 and max value is 5. I set the min to 1 and max to 3 in the viewDidLoad and it appears in the slider correctly.

Then I'm trying to change them to 2 and 4 upon a button tap but nothing's happening.

Demo project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.