Skip to content

Instantly share code, notes, and snippets.

@quangtqag
Created May 8, 2019 10:12
Show Gist options
  • Save quangtqag/2a6a84c6658350a15db6bfde6a3d05d8 to your computer and use it in GitHub Desktop.
Save quangtqag/2a6a84c6658350a15db6bfde6a3d05d8 to your computer and use it in GitHub Desktop.
override func viewDidLoad() {
super.viewDidLoad()
tableView.prefetchDataSource = self
}
// MARK: - Table View Data Source Prefetching
extension UsersTableViewController: UITableViewDataSourcePrefetching {
func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) {
print("prefetch rows at index paths: \(indexPaths)")
if indexPaths.contains(where: isLoadingCell) {
fetch()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment