Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.02 KB

README.md

File metadata and controls

41 lines (31 loc) · 1.02 KB

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