I currently, I'd like to change FSCalendar's scope with animation using Snapkit.
The code below can replace scope with week and month. But the animation doesn't work.
func calendar(_ calendar: FSCalendar, boundingRectWillChange bounds: CGRect, animated: Bool) {
self.calendar.snp.updateConstraints { make in
make.height.equalTo(bounds.height)
}
self.view.layoutIfNeeded()
}
Hard to say, without knowing your layout (is calendar a subview of a subview of a subview, for example?), but, in general, to animate constraints you want to "wrap" the
.layoutIfNeeded()in an animation block.Try this: