Skip to content

A small component for showing activity and title in navigation item title view. (Like Telegram when refreshing chats)

License

Notifications You must be signed in to change notification settings

SergeyPetrachkov/NavigationBarProgress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NavigationBarProgress

A simple drop-in library to show pending state in navigation bar (like Telegram does when refreshing chats).

Trivial usage sample:

final class ViewController: UIViewController, INavigationBarProgressContainer {

  private var isPending: Bool = false

  var activityView: UIView & INavigationBarProgressView = NavigationBarProgressView(
      config: .init(
        interItemSpace: 8,
        regularTitle: "Regular",
        pendingTitle: "Updating...",
        titleFont: .systemFont(ofSize: 16, weight: .medium)
      )
  )

  override func viewDidLoad() {
    super.viewDidLoad()
    self.attach(navigationActivityView: self.activityView)
  }

  @IBAction func didTapButton(_ sender: Any) {
    if self.isPending {
      self.stopNavigationActivity()
    } else {
      self.startNavigationActivity()
    }
    self.isPending.toggle()
  }
}

Result:

gif

Read more

About

A small component for showing activity and title in navigation item title view. (Like Telegram when refreshing chats)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages