Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliesup-voted.tooltip
Hi everybody. I also faced this problem. Here's my crutch:
private var isDragging = false
private var previousPointX: CGFloat?
private var dragTimer: Timer?
private func horizontalScrollHandler(forSection section: NSCollectionLayoutSection, completion: (() -> Void)?) {
section.visibleItemsInvalidationHandler = { [weak self] (_, point, _) in
guard let self = self else { return }
if let previousPointX = self.previousPointX, previousPointX != point.x {
self.isDragging = true
self.restartDragTimer(completion: completion)
}
self.previousPointX = point.x
}
}
private func restartDragTimer(completion: (() -> Void)?) {
self.dragTimer?.invalidate()
self.dragTimer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: false) { [weak self] _ in
self?.isDragging = false
completion?()
}
}
and in the completion block, I make the changes I need.
It is a pity that for so many years Apple has not made attempts to improve (or I didn't find it). :D
If there are better solutions, please write them down.