Skip to content

Commit

Permalink
Merge pull request #5 from cthieba3-ford/fix-crash-related-to-main-th…
Browse files Browse the repository at this point in the history
…read-scheduling

Prevent crashes due to main thread scheduling issues reloading UITableView
  • Loading branch information
rafiki270 authored Jun 26, 2019
2 parents b75664c + 5804777 commit b7be8db
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ fileprivate extension Array where Element == UITableViewCell.Type {
extension UITableView: PresentableCollectionElement {

func safeReloadData() {
DispatchQueue.main.async {
self.reloadData()
if Thread.isMainThread {
reloadData()
} else {
DispatchQueue.main.async {
self.reloadData()
}
}
}

Expand Down

0 comments on commit b7be8db

Please sign in to comment.