UICollectionView cells flashing/blinking briefly after animating collectionView position
<p>I have a UICollectionView which is pinned to Top Layout Guide (I use NavigationController so it's pinned to the Navigation Bar) and aligned to the bottom of an image which it overlays.</p>

<p>I am hiding the Navigation Bar and animating the Image position, which means because of the constraints the CollectionView is moving too.</p>

<p>In scrollViewDidScroll delegate method of my scrollView I am animating them like so:</p>

<pre><code>if scrollView.panGestureRecognizer.translation(in: scrollView).y &gt; 0 {
            //scrolling up
            navigationController?.setNavigationBarHidden(false, animated: true)
            UIView.animate(withDuration: 0.2, animations: {
                self.topImageContraintToTop.constant = 0
                self.view.layoutIfNeeded()
            })
        } else {
            //scrolling down
            navigationController?.setNavigationBarHidden(true, animated: true)
            UIView.animate(withDuration: 0.2, animations: {
                self.topImageContraintToTop.constant = -(self.navigationController?.navigationBar.bounds.size.height)! - 10
                self.view.layoutIfNeeded()
            })
        }
</code></pre>

<p>So everytime this animation is happening, the visible cells of the CollectionView are briefly flashing/blinking.</p>

<p>I have searched hours for solving but so far nothing really helped.</p>

<p>I'd appreciate any kind of approach for this problem.</p>