I am trying to animate the height change for a collection view, but I can't figure out how to get the animation to work. The height changes correctly, but it happens immediately, not animated.
@IBOutlet weak var collectionViewHeight: NSLayoutConstraint!
UIView.animateWithDuration(0.3, delay: 0, options: .CurveEaseOut, animations: {
self.collectionViewHeight.constant = 0
}
I tried searching for solutions, but couldn't find anything specific to this situation. Also tried layoutIfNeeded()
suggested here, but it didn't help: Animate view height with Swift
Any help much appreciated!