Inspired from Reddit app.... Add Progress Animation in just 2 steps in your view
- iOS 10.0+ / Mac OS X 10.9+ / watchOS 2.0+ / tvOS 9.0+
- Xcode 8.0+
To integrate RProgressView into your Xcode project using CocoaPods, specify it in your Podfile
:
use_frameworks!
pod 'RProgressView'
Then, run the following command:
$ pod install
To integrate RProgressView
into your Xcode project using Carthage, specify it in your Cartfile
:
github "jwd-ali/RProgressView"
If you prefer not to use a dependency manager, you can integrate RProgressView into your project manually.
- Add sources into your project:
- Drag
RProgressView.swift
andCALayer+Extension.swift
- Drag
If you are using any dependency manager (pods , carthage , package manager)to integrate RProgressView. Import RProgressView first:
import RProgressView
And for Manuall install you dont need to import anything
You need to simply initiate progressView
var progessView = RProgressView()
You can set number of circles you want in your progress view set numberOfCircles
property
progress.numberOfCircles = 4
You can show multi color Circles for that turn on isMultiColour
to true and add colours dotColors
according to number of circles like this
private lazy var progessViewMultiColour:RProgressView = { let progress = RProgressView() progress.isMultiColour = true progress.mainDotColor = .black progress.dotColors = [.red, .green, .blue , .brown] progress.numberOfCircles = 4 return progress }()
And if you want to show it i one colour you need. to set isMultiColour
to false and you don't need to give dotColors
as they are not needed
. private lazy var progessViewPlain:RProgressView = { let progress = RProgressView() progress.isMultiColour = false progress.numberOfCircles = 2 progress.translatesAutoresizingMaskIntoConstraints = false return progress }()
Then in which view you want to show progress call
progess.StartAnimating(in: self.view)
To stop and hide call
progess.stopAnimating()
For better understanding framework includes example project as well
Congratulations! You're done.
I’d love to have help on this project. For small changes please open a pull request, for larger changes please open an issue first to discuss what you’d like to see.