KDCircularProgress Documentation

repository·master·Indexed 22 days ago

https://github.com/kaandedeoglu/kdcircularprogress

A Swift-based circular progress view component for iOS featuring support for gradients, glows, and animations. It is compatible with Interface Builder via IBInspectable and IBDesignable, and can be installed via CocoaPods, Carthage, or manual integration. The library provides customizable properties for thickness, angles, and glow modes, along with methods for animating progress between specific angles.

Tokens
1.1K
Snippets
3
Records
9
Agent score
29%

What's inside KDCircularProgress

  1. Configure and use KDCircularProgress

    master

    You can instantiate and configure KDCircularProgress programmatically. It is recommended to use square frames to avoid unexpected results.

    Here is a complete setup example:

    progress = KDCircularProgress(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
    progress.startAngle = -90
    progress.progressThickness = 0.2
    progress.trackThickness = 0.6
    progress.clockwise = true
    progress.gradientRotateSpeed = 2
    progress.roundedCorners = false
    progress.glowMode = .forward
    progress.glowAmount = 0.9
    progress.set(colors: UIColor.cyan ,UIColor.white, UIColor.magenta, UIColor.white, UIColor.orange)
    progress.center = CGPoint(x: view.center.x, y: view.center.y + 25)
    view.addSubview(progress)
  2. Animate KDCircularProgress

    master

    Use the following methods to animate the progress view:

    • animateFromAngle(fromAngle:toAngle:duration:relativeDuration:completion:): Animates from a specific starting angle to a target angle. relativeDuration determines if the duration is for the specific segment or for a full turn.
    • animateToAngle(toAngle:duration:completion:): Animates from the current state to a target angle.
    • pauseAnimation(): Pauses any active animation.
    • isAnimating() -> Bool: Returns true if an animation is currently running.
  3. Configure KDCircularProgress glow modes

    master

    The glowMode property (of type KDCircularProgressGlowMode) controls how the glow effect scales with the progress angle:

    • .forward: Glow increases proportionally to the angle (0 at 0°, full at 360°).
    • .reverse: Glow increases inversely to the angle (full at 0°, 0 at 360°).
    • .constant: The glow intensity remains constant.
    • .noGlow: No glow effect is applied.
  4. Configure KDCircularProgress visual properties

    master

    The following properties allow you to customize the appearance of the circular progress view:

    PropertyTypeDescription
    progressColors[UIColor]Colors used for the gradient. If only one color is provided, it uses a fill instead.
    angleIntThe current visual progress (0 to 360).
    startAngleIntThe starting angle (0 to 360). Values outside this range are automatically modulated.
    clockwiseBoolDirection of progress. true for clockwise, false for counter-clockwise.
    roundedCornersBoolIf true, the ends of the progress track are drawn with a half-circle radius.
    gradientRotateSpeedCGFloatNumber of 2π rotations the gradient performs per full progress cycle.
    glowAmountCGFloatIntensity of the glow (0.0 to 1.0).
    glowModeKDCircularProgressGlowModeDetermines how the glow behaves relative to the angle.
    progressThicknessCGFloatThickness of the progress bar (0.0 to 1.0).
    trackThicknessCGFloatThickness of the background track (0.0 to 1.0).
    trackColorUIColorColor of the background track.
    progressInsideFillColorUIColorColor of the center of the circle.