Activity navigation bar provides a custom navigation bar with a build in activity indicator. The activity indicator is styled like a progress bar, but is intended to be used to indicate indeterminate activity time.
To achieve this, the activity is started with a 'waitAt' parameter. The activity bar will then animate progress to this point, and stop. Then, once our indeterminate activity has finished, we finish the activity indicator.
ActivityNavigationBar is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ActivityNavigationBar"
- Set the class type of your navigation bar from UINavigationBar to ActivityNavigationBar in your storyboard scene or Xib
- In the view controller class corresponding to your storyboard scene, create an optional var which will allow you to reference the ActivityNavigationBar;
var activityNavigationBar: ActivityNavigationBar? {
return navigationController?.navigationBar as? ActivityNavigationBar
}
- Now, use the ActivityNavigationBar as follows.
Start it;
activityNavigationBar?.startActivity(andWaitAt: 0.8)
Finish it;
activityNavigationBar?.finishActivity(withDuration: duration)
Reset it;
activityNavigationBar?.reset()
To run the example project, clone the repo, and run pod install
from the Example directory first.
Pete Smith, peadar81@gmail.com
ActivityNavigationBar is available under the MIT license. See the LICENSE file for more info.