HGCircularSlider Documentation
repository·master·Indexed 25 days ago
https://github.com/hamzaghazouani/hgcircularsliderA Swift library for iOS providing circular slider components, including CircularSlider for basic range selection, RangeCircularSlider for dual-thumb selection, and MidPointCircularSlider for midpoint selection. It can also be configured as a non-interactive progress view.
What's inside HGCircularSlider
- HGCircularSlider is available through Swift Package Manager. You can add it to your Xcode project by following the standard Apple documentation for adding package dependencies.
Install HGCircularSlider via CocoaPods
masterTo install HGCircularSlider using CocoaPods, add the following line to your Podfile:
pod 'HGCircularSlider', '~> 2.2.1'Install HGCircularSlider via Carthage
masterTo install HGCircularSlider using Carthage, add the following line to your Cartfile:
github "HamzaGhazouani/HGCircularSlider"Use MidPointCircularSlider for midpoint selection
masterUse
MidPointCircularSliderto set a value relative to a midpoint within a range.let circularSlider = MidPointCircularSlider(frame: myFrame) circularSlider.minimumValue = 0.0 circularSlider.maximumValue = 10.0 circularSlider.distance = 1.0 circularSlider.midPointValue = 5.0Use RangeCircularSlider for dual-thumb selection
masterUse
RangeCircularSliderto define a range between two points. You can customize the thumb images and set the number of rotations (rounds) for the full range.let circularSlider = RangeCircularSlider(frame: myFrame) circularSlider.startThumbImage = UIImage(named: "Bedtime") circularSlider.endThumbImage = UIImage(named: "Wake") let dayInSeconds = 24 * 60 * 60 circularSlider.maximumValue = CGFloat(dayInSeconds) circularSlider.startPointValue = 1 * 60 * 60 circularSlider.endPointValue = 8 * 60 * 60 circularSlider.numberOfRounds = 2 // Two rotations for full 24h rangeUse HGCircularSlider as a progress view
masterTo use a
CircularSlideras a non-interactive progress view, disable user interaction and set the thumb width and radius to zero.let progressView = CircularSlider(frame: myFrame) progressView.minimumValue = 0.0 progressView.maximumValue = 1.0 progressView.endPointValue = 0.2 // the progress progressView.userInteractionEnabled = false // to remove padding, for more details see issue #25 progressView.thumbLineWidth = 0.0 progressView.thumbRadius = 0.0Use CircularSlider for basic range selection
masterUse
CircularSliderto create a simple slider with a minimum value, maximum value, and a single end point value.let circularSlider = CircularSlider(frame: myFrame) circularSlider.minimumValue = 0.0 circularSlider.maximumValue = 1.0 circularSlider.endPointValue = 0.2