CircleProgressView

Overview

iOS CircleProgressView

This control will allow a user to use code instantiated or interface builder to create and render a circle progress view.

This repository is referenced in the blog post: iOS CircleProgressView

NOTE: There is an Objective-C version of the control in this project as well. Cocopods however will only pull the swift project. If you need to integrate the Obj-C version, that is not supported at this time. May add a new podspec for that if someone wants to create a pull request for that feature.

Features

  • Increase or decreasing progress changes.
  • Variable track width.
  • Track image optional.
  • Track background color.
  • Track fill color.
  • Track border color.
  • Track border width.
  • Center fill color.
  • Center fill image.

Requirements

Xcode 8 Swift 3.0 iOS 8 +

Configuration

  • If you are using a swift only project simply copy CircleProgressView.swift to your project. Swift requires no specific imports.

  • If you are using a hybrid app where you are starting with an objective c project, you will need to import the swift class by full name.

#import "CircleProgressView-Swift.h"

CocoaPods

Current version is 1.0.12

pod 'CircleProgressView', :git => 'https://github.com/CardinalNow/iOS-CircleProgressView.git'

or

pod 'CircleProgressView', '~> 1.0'

Usage

CircleProgressView can be used via code or interface builder.

  • If configuring via code, use the traditional init methods and properties.

  • If using Interface Builder, CircleProgressView takes advantage of Xcode 6's new

@IBDesignable 

and

@IBInspectable 

properties that allow developers to render and configure custom controls in Interface Builder.

Animation

You can now update the progress view with animation using the new animated option.

Preview

Interface Builder live rendering.

Live Rendering

Interface Builder control configurations.

Controls

App Preview

Preview Simulator Preview Simulator

Author / License

Copyright Cardinal Solutions 2013. Licensed under the MIT license. LOGO

Comments
  • Crash

    Crash

    Assertion failed: (start_angle >= end_angle), function void CG::Path::Subpath::add_arc(const CGPoint &, double, double, double, bool, const CGAffineTransform *), file Paths/path-subpath-arc.cc, line 53.

    opened by BilalReffas 10
  • Duplication Issue

    Duplication Issue

    I am trying to have 2+ instances of the circle progress view in my app, but while creating the second instance xcode will lockup and never recover. Any guidance would be appreciated.

    opened by zholbrook 6
  • warning: IB Designables: Using class UIView for object with custom class because the class CircleProgressView does not exist

    warning: IB Designables: Using class UIView for object with custom class because the class CircleProgressView does not exist

    I was trying to use CircleProgressView in IB. But it doesn't show up and I've got these warnings: warning: IB Designables: Using class UIView for object with custom class because the class CircleProgressView does not exist warning: IB Designables: Ignoring user defined runtime attribute for key path "trackWidth" on instance of "UIView". Hit an exception when attempting to set its value: [...]: this class is not key value coding-compliant for the key trackWidth.

    opened by oligazar 5
  • Request - bump pod version

    Request - bump pod version

    Hi there, thanks for the nice pod and can't say enough thanks to you guys. I've converted my app to swift 4.2 and compiler is complaining on CircleProgressView. It seems that the latest swift 4.2 was made to master yet pushed to pods. can you do a version bump and pod repo push? Thanks

    opened by yuweipei 4
  • Swift Compiler Warnings

    Swift Compiler Warnings

    Hi,

    I updated to CircleProgressView (1.1.2) and i still get compiler warnings here:

            let startAngle:CGFloat = clockwise ? CGFloat(-internalProgress * M_PI / 180.0) : CGFloat(constants.twoSeventyDegrees * M_PI / 180)
            let endAngle:CGFloat = clockwise ? CGFloat(constants.twoSeventyDegrees * M_PI / 180) : CGFloat(-internalProgress * M_PI / 180.0)
     
            progressPath.addArc(withCenter: center, radius:radius, startAngle:startAngle, endAngle:endAngle, clockwise:!clockwise)
            let r = radius - trackWidth * 0.5
            if roundedCap {
                let capCenter = CGPoint(x: center.x + r * cos(endAngle), y: center.y + r * sin(endAngle))
            
                progressPath.addArc(withCenter: capCenter, radius: trackWidth * 0.5, startAngle: endAngle, endAngle: endAngle + CGFloat(M_PI), clockwise: !clockwise)
            }
            progressPath.addArc(withCenter: center, radius:radius-trackWidth, startAngle:endAngle, endAngle:startAngle, clockwise:clockwise)
            
            if roundedCap {
            let capCenter = CGPoint(x: center.x + r * cos(startAngle), y: center.y + r * sin(startAngle))
            
                progressPath.addArc(withCenter: capCenter, radius: trackWidth * 0.5, startAngle: startAngle, endAngle: startAngle + CGFloat(M_PI), clockwise: clockwise)
            }
    
    opened by sschizas 4
  • Obj C version not found

    Obj C version not found

    Could you mention the steps to get the Obj C version.- not the obj C directive -referring to closed issue Also would you improve on this and add multiple sliders to the same.( each slider will show a different color on different portion of screen)

    opened by paulantony87 4
  • CocoaPods 0.36.0 - CircleProgressView in a Swift project

    CocoaPods 0.36.0 - CircleProgressView in a Swift project

    Hello, if you want to use CircleProgressView in a Swift project, it has to be compiled as a Framework, that whats cocoapod does, but the source needs to be modified.

    Class's access must be public, otherwise I cannot declare a object of class CircleProgressView Some vars needs to be public too, like the "progress" var.

    Please address this issue, because I don't want to fix it manually every time I do "pod install" to update my project ;-)

    @IBDesignable public class CircleProgressView: UIView { @IBInspectable public var progress: Double = 0.000001 { didSet { setNeedsDisplay() } }

    opened by vitobellini 4
  • Create new Podspec version

    Create new Podspec version

    Hi,

    your last commit resolved the

    'M_PI' is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.

    issue. Please create a new Podspec version to make it accessible.

    Thanks

    opened by honkmaster 3
  • How can animate ?

    How can animate ?

    how can animate automatically with UIView:animateWithDuration:animations: ? the example below is not working :

        [UIView animateWithDuration:5.0 animations:^{
            self.progressView.progress = 1.0;
        }];
    
    opened by priore 3
  • I want to add two labels inside circle, where can I add

    I want to add two labels inside circle, where can I add

    Thanks for the good library,But, I want to add two labels inside circle, how can I add, and I want to show some animation while loading the circle, we are not using swift button to increase value, I have some Integer value, while loading that value I want to show some kind animation like loading circle.

    Can you suggest me, how to go this?

    opened by AnilkumarRabhasa 2
  • iOS 7 compatible?

    iOS 7 compatible?

    In Readme file, it is compatible with iOS 7. But in podspec file, it require iOS 8. So, I can't use CocoaPod to install lib. I have to drop file manual. It is compatible iOS 7. Can you edit the podspec file for iOS 7?

    opened by huynguyencong 2
Releases(1.1.2)
Owner
Cardinal Solutions Group
Cardinal Solutions Group