Problem looks like this: http://i.imgur.com/5iaAiGQ.mp4 (red is a color of cell.contentView)
Here is the code: https://github.com/nezhyborets/UICollectionViewContentsAni
The solution is very easy. First, in ViewController.collectionView(_,didSelectItemAt:), write only this:
collectionView.performBatchUpdates({
self.selectedIndex = indexPath.row
}, completion: nil)
And then, in the class ProblematicCollectionViewCell add this func:
override func apply(_ layoutAttributes: UICollectionViewLayoutAttributes) {
super.apply(layoutAttributes)
self.layoutIfNeeded()
}
Enjoy!