In my table view I have to scroll to the top. But I cannot guarantee that the first object is going to be section 0, row 0. May be that my table view will start from section
Swift 5, iOS 13
I know this question already has a lot of answers but from my experience, there is only one method that always works:
tableView.scrollToRow(at: IndexPath(row: someArray.count - 1, section: 0), at: .bottom, animated: true)
If you're working in async, tables that animate with keyboards, etc., the other answers will often scroll to the almost bottom, not the absolute bottom. This method will get you to the absolute end of a table every time.