For Gray Activity Indicator At the bottom add a custom cell with a Activity indicator along with a label stating "fetching more..........." or else show like below
To Add Activity indicator in tableview
func showIndicator() {
let spinner = UIActivityIndicatorView(activityIndicatorStyle: .gray)
spinner.startAnimating()
tableView.backgroundView = spinner
}
To get last cells and load more data from api
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if yourArr.count-1 == indexPath.row{
getMoreImages(page)
}
}
func getMoreImages(page:Int){
//hit api
if api_success == true {
if self.page == 0 {
self.yourArr.removeAll()
}
self.yourArr.appendContentsOf(api_data)
self.tableView.reloadData()
self.page = self.page + 1
}
}