From 5804777e27f80222404bfcef6688b361af8c856b Mon Sep 17 00:00:00 2001 From: common Date: Wed, 26 Jun 2019 15:54:37 -0400 Subject: [PATCH] Modify safeReload in Presentables+UITableView to reload directly instead of dispatching to the main thread if it is already on the main thread. --- .../Classes/Table views/Presentables+UITableView.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Presentables/Classes/Table views/Presentables+UITableView.swift b/Presentables/Classes/Table views/Presentables+UITableView.swift index efbd4d0..c2c5acc 100644 --- a/Presentables/Classes/Table views/Presentables+UITableView.swift +++ b/Presentables/Classes/Table views/Presentables+UITableView.swift @@ -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() + } } }