Fix tableview access on main thread
This commit is contained in:
@@ -103,9 +103,14 @@ extension IncrementalDataSourceUpdate {
|
|||||||
dataSource.insert(obj, at: to)
|
dataSource.insert(obj, at: to)
|
||||||
if shouldLiveUpdateIncrementalDataSource() {
|
if shouldLiveUpdateIncrementalDataSource() {
|
||||||
DispatchQueue.main.sync {
|
DispatchQueue.main.sync {
|
||||||
let cell = tableView.cellForRow(at: IndexPath(row: from))
|
if tableView.isFrontmost {
|
||||||
cell?.detailTextLabel?.text = obj.detailCellText
|
let source = IndexPath(row: from)
|
||||||
tableView.safeMoveRow(from, to: to)
|
let cell = tableView.cellForRow(at: source)
|
||||||
|
cell?.detailTextLabel?.text = obj.detailCellText
|
||||||
|
tableView.moveRow(at: source, to: IndexPath(row: to))
|
||||||
|
} else {
|
||||||
|
tableView.reloadData()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
didUpdateIncrementalDataSource(.Move, row: from, moveTo: to)
|
didUpdateIncrementalDataSource(.Move, row: from, moveTo: to)
|
||||||
|
|||||||
Reference in New Issue
Block a user