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.
- iOS 11.0+
- Xcode 10.0+
For manual instalation, drag Source folder into your project.
or use CocoaPod adding this line to you Podfile
:
pod 'PKProgressView'
PKProgressView
can ne initated by code or can be assigned to UIView
in Interface Builder
Example:
let progressView = PKProgressView(frame: CGRect(x: 10.0, y: 20.0, width: 200.0, height: 5.0))
- Just add and
UIView
on theUIViewController
. - Assign the
PKProgressView
class toUIView
. - Create an
IBOutlet
for the same view.
Example:
@IBOutlet weak var progressView: PKProgressView!
There are the following two way to set the progress:
Example:
- Just call
setProgress()
method from instance ofPKProgressView
. - Pass the
TimeInterval
in seconds in how much seconds you want to fill the progress.
progressView.setProgress(progress: 1.0, inSeconds: 10.0)
Example 1:
- Just assign the progress value in
progress
property ofPKProgressView
instance.
progressView.progress = 0.3
Example 2:
- Just call
setProgress()
method from instance ofPKProgressView
. - Pass the
TimeInterval
as0.0
.
progressView.setProgress(progress: 1.0, inSeconds: 0.0)
To make some modification you can use the following properties, Like:
-
trackingImage
used to assign the tracking image, that will shown above the progress bar. Default:nil
-
trackingImageSize
used to give the size for the tracking image. Default:CGSize(width: 25.0, height: 25.0)
-
trackTint
used to fill the background color of the progress view. Default:UIColor.lightGray
-
progressTint
used to fill the progress of the progress view. Default:UIColor.blue
-
trackBorderWidth
used to give the border for the progress view. Default:0.0
-
progressBorderWidth
used to give the border for progress of the progress view. Default:0.0
-
trackBorderColor
used to give the border color for the progress view. Default:UIColor.lightGray
-
progressBorderColor
used to give the border color for progress of the progress view. Default:UIColor.blue
PKProgressView
is released under the MIT license.