PKProgressView
A Swift based helper class that will provide a progress view that can be used to fill it with animation, also can be used for car animation.
Requirements
- iOS 11.0+
- Xcode 10.0+
Installation
For manual instalation, drag Source folder into your project.
or use CocoaPod adding this line to you Podfile:
pod 'PKProgressView'Usage
Initialization:
PKProgressView can ne initated by code or can be assigned to UIView in Interface Builder
By Code:
Example:
let progressView = PKProgressView(frame: CGRect(x: 10.0, y: 20.0, width: 200.0, height: 5.0))By IB (Interface Builder):
- Just add and
UIViewon theUIViewController. - Assign the
PKProgressViewclass toUIView. - Create an
IBOutletfor the same view.
Example:
@IBOutlet weak var progressView: PKProgressView!Set Progress
There are the following two way to set the progress:
With Animation:
Example:
- Just call
setProgress()method from instance ofPKProgressView. - Pass the
TimeIntervalin seconds in how much seconds you want to fill the progress.
progressView.setProgress(progress: 1.0, inSeconds: 10.0)Without Animation:
Example 1:
- Just assign the progress value in
progressproperty ofPKProgressViewinstance.
progressView.progress = 0.3Example 2:
- Just call
setProgress()method from instance ofPKProgressView. - Pass the
TimeIntervalas0.0.
progressView.setProgress(progress: 1.0, inSeconds: 0.0)Configuration To Modify
To make some modification you can use the following properties, Like:
-
trackingImageused to assign the tracking image, that will shown above the progress bar. Default:nil -
trackingImageSizeused to give the size for the tracking image. Default:CGSize(width: 25.0, height: 25.0) -
trackTintused to fill the background color of the progress view. Default:UIColor.lightGray -
progressTintused to fill the progress of the progress view. Default:UIColor.blue -
trackBorderWidthused to give the border for the progress view. Default:0.0 -
progressBorderWidthused to give the border for progress of the progress view. Default:0.0 -
trackBorderColorused to give the border color for the progress view. Default:UIColor.lightGray -
progressBorderColorused to give the border color for progress of the progress view. Default:UIColor.blue
Licence
PKProgressView is released under the MIT license.

