Skip to content

Commit 5804777

Browse files
commoncommon
authored andcommitted
Modify safeReload in Presentables+UITableView to reload directly instead of dispatching to the main thread if it is already on the main thread.
1 parent b75664c commit 5804777

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Presentables/Classes/Table views/Presentables+UITableView.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ fileprivate extension Array where Element == UITableViewCell.Type {
2121
extension UITableView: PresentableCollectionElement {
2222

2323
func safeReloadData() {
24-
DispatchQueue.main.async {
25-
self.reloadData()
24+
if Thread.isMainThread {
25+
reloadData()
26+
} else {
27+
DispatchQueue.main.async {
28+
self.reloadData()
29+
}
2630
}
2731
}
2832

0 commit comments

Comments
 (0)