Detect when UITableView has scrolled to the bottom

Try this:

func scrollViewDidScroll(_ scrollView: UIScrollView) {
    let height = scrollView.frame.size.height
    let contentYOffset = scrollView.contentOffset.y
    let distanceFromBottom = scrollView.contentSize.height - contentYOffset

    if distanceFromBottom < height {
        print("You reached end of the table")
    }
}

or you can try this way:

if tableView.contentOffset.y >= (tableView.contentSize.height - tableView.frame.size.height) {    
    /// you reached the end of the table
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)