Created
June 22, 2020 18:56
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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