This is the subclass of UISlider.
This slider can set track color between center point and track thumb image.
- Swift5.0
- iOS 9.0+
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.
Just add to your Cartfile:
github "taji-taji/CenterOriginSlider"
- Haptics at center.
- InterfaceBuilder supporting.
@IBDesignable
@IBInspectable
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
.
@IBInspectable open var minimumTrackBackgroundColor: UIColor
UIColor.lightGray
@IBInspectable open var minimumTrackForegroundColor: UIColor
UIColor.black
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
.
@IBInspectable open var maximumTrackBackgroundColor: UIColor
UIColor.lightGray
@IBInspectable open var maximumTrackForegroundColor: UIColor
UIColor.black
The height for track.
@IBInspectable open var trackHeight: CGFloat
1.5
If true, light impact feedback will occur when the value of the slider is changed to the center value.
open var isCenterFeedbackEnabled: Bool
true
MIT