Skip to content

Instantly share code, notes, and snippets.

@levibostian
Created June 22, 2020 18:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levibostian/7c659d632e633142bc8a0e5ad9ef6927 to your computer and use it in GitHub Desktop.
Save levibostian/7c659d632e633142bc8a0e5ad9ef6927 to your computer and use it in GitHub Desktop.
Swift show/hide loading indicator at the bottom of the list. Great for paging.
import UIKit
extension UITableView {
func showLoadingFooter() {
let spinner = UIActivityIndicatorView(style: .gray)
spinner.startAnimating()
spinner.frame = CGRect(x: CGFloat(0), y: CGFloat(0), width: self.bounds.width, height: CGFloat(44))
self.tableFooterView = spinner
self.tableFooterView?.isHidden = false
}
func hideLoadingFooter() {
self.tableFooterView?.isHidden = true
self.tableFooterView = nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment