mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-05-22 23:42:50 +08:00
24 lines
553 B
Swift
24 lines
553 B
Swift
//
|
|
// UIViewController+LoadingIndicator.swift
|
|
// Freetime
|
|
//
|
|
// Created by Ryan Nystrom on 5/7/17.
|
|
// Copyright © 2017 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
extension UIViewController {
|
|
|
|
func showLoadingIndicator(_ show: Bool) {
|
|
if show {
|
|
let view = UIActivityIndicatorView(activityIndicatorStyle: .gray)
|
|
view.startAnimating()
|
|
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: view)
|
|
} else {
|
|
navigationItem.rightBarButtonItem = nil
|
|
}
|
|
}
|
|
|
|
}
|