HGCircularSlider Documentation

repository·master·Indexed 25 days ago

https://github.com/hamzaghazouani/hgcircularslider

A 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.

Tokens
832
Snippets
6
Records
7
Agent score
33%

What's inside HGCircularSlider

  1. Use MidPointCircularSlider for midpoint selection

    master

    Use MidPointCircularSlider to 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.0
  2. Use RangeCircularSlider for dual-thumb selection

    master

    Use RangeCircularSlider to 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 range
  3. Use HGCircularSlider as a progress view

    master

    To use a CircularSlider as 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.0
  4. Use CircularSlider for basic range selection

    master

    Use CircularSlider to 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