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

Primary LanguageSwiftMIT LicenseMIT

PKProgressView

CocoaPods codebeat badge

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.

preview

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):

  1. Just add and UIView on the UIViewController.
  2. Assign the PKProgressView class to UIView.
  3. Create an IBOutlet for the same view.

Example:

@IBOutlet weak var progressView: PKProgressView!

Set Progress

There are the following two way to set the progress:

With Animation:

Example:

  1. Just call setProgress() method from instance of PKProgressView.
  2. Pass the TimeInterval in seconds in how much seconds you want to fill the progress.
progressView.setProgress(progress: 1.0, inSeconds: 10.0)

Without Animation:

Example 1:

  1. Just assign the progress value in progress property of PKProgressView instance.
progressView.progress = 0.3

Example 2:

  1. Just call setProgress() method from instance of PKProgressView.
  2. Pass the TimeInterval as 0.0.
progressView.setProgress(progress: 1.0, inSeconds: 0.0)

Configuration To Modify

To make some modification you can use the following properties, Like:

  1. trackingImage used to assign the tracking image, that will shown above the progress bar. Default: nil

  2. trackingImageSize used to give the size for the tracking image. Default: CGSize(width: 25.0, height: 25.0)

  3. trackTint used to fill the background color of the progress view. Default: UIColor.lightGray

  4. progressTint used to fill the progress of the progress view. Default: UIColor.blue

  5. trackBorderWidth used to give the border for the progress view. Default: 0.0

  6. progressBorderWidth used to give the border for progress of the progress view. Default: 0.0

  7. trackBorderColor used to give the border color for the progress view. Default: UIColor.lightGray

  8. progressBorderColor used to give the border color for progress of the progress view. Default: UIColor.blue

Licence

PKProgressView is released under the MIT license.