Created
December 6, 2019 10:28
-
-
Save hira22/884f0c557529acbc6c7ea55b58dba80b to your computer and use it in GitHub Desktop.
This file contains 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
// 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