taji-taji / CenterOriginSlider

iOS Custom Slider.
MIT License
9 stars 2 forks source link
ios swift

Carthage compatible Swift version

About CenterOriginSlider

This is the subclass of UISlider.
This slider can set track color between center point and track thumb image.

Requirements

Installation

Swift Packege Manager

Add the following as a dependency to your Package.swift:

dependencies: [
    .package(url: "https://github.com/taji-taji/CenterOriginSlider.git", from: "0.4.0")
]

or add dependencies from Xcode.

Carthage

Just add to your Cartfile:

github "taji-taji/CenterOriginSlider"

Features

1
2

Properties

minimumTrackBackgroundColor, minimumTrackForegroundColor

The minimum track color.
If the value is less than or equal center value, minimum track color between minimum point and track thumb image is filled with minimumTrackBackgroundColor.
On the other hand, if the value is greater than center value, minimum track color between minimum point and center point is filled with minimumTrackBackgroundColor.
And minimum track color between center point and track thumb image is filled with minimumTrackForegroundColor.

minimumTrackBackgroundColor

@IBInspectable open var minimumTrackBackgroundColor: UIColor

default

UIColor.lightGray

minimumTrackForegroundColor

@IBInspectable open var minimumTrackForegroundColor: UIColor

default

UIColor.black

maximumTrackBackgroundColor, maximumTrackForegroundColor

The maximum track color.
If the value is greater than or equal center value, maximum track color between maximum point and track thumb image is filled with maximumTrackBackgroundColor.
On the other hand, if the value is less than center value, maximum track color between minimum point and center point is filled with maximumTrackBackgroundColor.
And minimum track color between center point and track thumb image is filled with maximumTrackForegroundColor.

maximumTrackBackgroundColor

@IBInspectable open var maximumTrackBackgroundColor: UIColor

default

UIColor.lightGray

maximumTrackForegroundColor

@IBInspectable open var maximumTrackForegroundColor: UIColor

default

UIColor.black

trackHeight

The height for track.

@IBInspectable open var trackHeight: CGFloat

default

1.5

isCenterFeedbackEnabled

If true, light impact feedback will occur when the value of the slider is changed to the center value.

open var isCenterFeedbackEnabled: Bool

default

true

License

MIT