Created
May 8, 2019 10:12
-
-
Save quangtqag/2a6a84c6658350a15db6bfde6a3d05d8 to your computer and use it in GitHub Desktop.
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
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