NavigationProgress

A simple way to make UIProgressView attach to top of UINavigationController.
import NavigationProgress
NavigationProgress.setup()
startNavigationProgress(with: NavigationProgress(totalPages: 3))
All done, and you can have this:

|
.oneTime |
.always |
push |
 |
 |
present fullscreen |
 |
 |
present overCurrentContext |
 |
 |
Requirements
Installation
Swift Package Manager
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler.
Once you have your Swift package set up, adding NavigationProgress as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/chrisnyw/NavigationProgress", from: "0.2")
]
How to use
- Import NavigationProgress
Import NavigationProgress
when you need.
import NavigationProgress
– NavigationProgress setup
Call setup()
once your app start to enable the swizzleHelper to make NavigationProgress work properly
NavigationProgress.setup()
- start NavigationProgress in your UIViewController
Ensure your UIViewController
is under UINavigationController
, and calls startNavigationProgress(with:)
in your current viewController
class.
Once your call startNavigationProgress()
, it treats your current page is first page and NavigationProgress will be shown. Meanwhile, when your back to your previous page, NavigationProgress will be remove from your navigationController.
startNavigationProgress(with: NavigationProgress(totalPages: 3))
- force remove NavigationProgres
Force remove the existing NavigationProgress from your navigationController
removeNavigationProgress()
Configuration
- Object NavigationProgress
totalPages
is the only compulsory property for object NavigationProgress
NavigationProgress(totalPages: 3)
Or you may configure NavigationProgress by passing all values
NavigationProgress(totalPages: 3,
progressType: .oneTime, // default .oneTime
progressTintColor: .orange, // default .orange
trackTintColor: .gray, // default .gray
animationDuration: 0.3) // default 0.3
– Property totalPages
Adjusts the total number of pages, used for calculate the total value for progressBarView.
navigationProgress.totalPages = 3
– Property progressType
Set NavigationProgress
progress type for only display for oneTime
or always
- .oneTime
NavigationProgress will be removed after passed the totalPages
- .oneTime
NavigationProgress will not be removed after passed the totalPages. Thus, when you back to page before totalPages NavigationProgress will be shown again.
public enum ProgressType {
case oneTime
case always
}
– Property progressTintColor
Adjusts the color shown for the portion of the progress bar that is filled.
navigationProgress.progressTintColor = .orange
– Property trackTintColor
Adjusts the color shown for the portion of the progress bar that is not filled.
navigationProgress.trackTintColor = .gray
– Property animationDuration
Adjusts animation duration for show / hide NavigationProgress once it is added or removed
navigationProgress.animationDuration = 0.3
Author
Chris Ng (chrisnyw@gmail.com)
License
NavigationProgress is available under the MIT license. See the LICENSE file for more info.
NavigationProgress
All done, and you can have this:
Requirements
Installation
Swift Package Manager
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the
swift
compiler.Once you have your Swift package set up, adding NavigationProgress as a dependency is as easy as adding it to the
dependencies
value of yourPackage.swift
.How to use
- Import NavigationProgress
Import
NavigationProgress
when you need.– NavigationProgress setup
Call
setup()
once your app start to enable the swizzleHelper to make NavigationProgress work properly- start NavigationProgress in your UIViewController
Ensure your
UIViewController
is underUINavigationController
, and callsstartNavigationProgress(with:)
in your currentviewController
class. Once your callstartNavigationProgress()
, it treats your current page is first page and NavigationProgress will be shown. Meanwhile, when your back to your previous page, NavigationProgress will be remove from your navigationController.- force remove NavigationProgres
Force remove the existing NavigationProgress from your navigationController
Configuration
- Object NavigationProgress
totalPages
is the only compulsory property for objectNavigationProgress
Or you may configure NavigationProgress by passing all values
– Property
totalPages
Adjusts the total number of pages, used for calculate the total value for progressBarView.
– Property
progressType
Set
NavigationProgress
progress type for only display foroneTime
oralways
- .oneTime
NavigationProgress will be removed after passed the totalPages
- .oneTime
NavigationProgress will not be removed after passed the totalPages. Thus, when you back to page before totalPages NavigationProgress will be shown again.
– Property
progressTintColor
Adjusts the color shown for the portion of the progress bar that is filled.
– Property
trackTintColor
Adjusts the color shown for the portion of the progress bar that is not filled.
– Property
animationDuration
Adjusts animation duration for show / hide NavigationProgress once it is added or removed
Author
Chris Ng (chrisnyw@gmail.com)
License
NavigationProgress is available under the MIT license. See the LICENSE file for more info.