Skip to content

Instantly share code, notes, and snippets.

@hira22
Created December 6, 2019 10:28
Show Gist options
  • Save hira22/884f0c557529acbc6c7ea55b58dba80b to your computer and use it in GitHub Desktop.
Save hira22/884f0c557529acbc6c7ea55b58dba80b to your computer and use it in GitHub Desktop.
// MARK: UITableViewDelegate
extension ListViewController: UITableViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let currentOffsetY = scrollView.contentOffset.y
let maximumOffset = scrollView.contentSize.height - scrollView.frame.height
let distanceToBottom = maximumOffset - currentOffsetY
// ボトムまでの距離が500未満になったら更新を行う
if distanceToBottom < 500 {
// なんか追加読み込みの処理
// viewModel.fetch()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment