|
@@ -71,3 +71,16 @@ extension UIAlertController.Style {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+extension UITableView {
|
|
|
+ func scrollToTop() {
|
|
|
+ let numberOfSections = self.numberOfSections
|
|
|
+ if numberOfSections > 0 {
|
|
|
+ let numberOfRows = self.numberOfRows(inSection: 0)
|
|
|
+ if numberOfRows > 0 {
|
|
|
+ let indexPath = IndexPath(row: 0, section: 0)
|
|
|
+ self.scrollToRow(at: indexPath, at: UITableView.ScrollPosition.top, animated: false)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|