diff --git a/Display/ListView.swift b/Display/ListView.swift index ef0293f032..f8630da8a9 100644 --- a/Display/ListView.swift +++ b/Display/ListView.swift @@ -1142,12 +1142,13 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture } } else if let itemHighlightOverlayBackground = self.itemHighlightOverlayBackground { self.itemHighlightOverlayBackground = nil - transition.updateAlpha(node: itemHighlightOverlayBackground, alpha: 0.0, completion: { [weak itemHighlightOverlayBackground] _ in - itemHighlightOverlayBackground?.removeFromSupernode() - }) for (_, headerNode) in self.itemHeaderNodes { self.view.bringSubview(toFront: headerNode.view) } + self.view.bringSubview(toFront: itemHighlightOverlayBackground.view) + transition.updateAlpha(node: itemHighlightOverlayBackground, alpha: 0.0, completion: { [weak itemHighlightOverlayBackground] _ in + itemHighlightOverlayBackground?.removeFromSupernode() + }) if let verticalScrollIndicator = self.verticalScrollIndicator { verticalScrollIndicator.view.superview?.bringSubview(toFront: verticalScrollIndicator.view) } diff --git a/Display/ListViewTransactionQueue.swift b/Display/ListViewTransactionQueue.swift index 55c904f0db..3e6f1793dd 100644 --- a/Display/ListViewTransactionQueue.swift +++ b/Display/ListViewTransactionQueue.swift @@ -15,13 +15,13 @@ public final class ListViewTransactionQueue { } public func addTransaction(_ transaction: @escaping ListViewTransaction) { - assert(Thread.isMainThread) + precondition(Thread.isMainThread) let beginTransaction = self.transactions.count == 0 self.transactions.append(transaction) if beginTransaction { transaction({ [weak self] in - assert(Thread.isMainThread) + precondition(Thread.isMainThread) if Thread.isMainThread { if let strongSelf = self { @@ -39,7 +39,7 @@ public final class ListViewTransactionQueue { } private func endTransaction() { - assert(Thread.isMainThread) + precondition(Thread.isMainThread) Queue.mainQueue().async { self.transactionCompleted() if !self.transactions.isEmpty { @@ -48,7 +48,7 @@ public final class ListViewTransactionQueue { if let nextTransaction = self.transactions.first { nextTransaction({ [weak self] in - assert(Thread.isMainThread) + precondition(Thread.isMainThread) if Thread.isMainThread { if let strongSelf = self {