I want to zoom and scroll a UIScrollView with a CGPathRef. Because of that I assume I have to animate the UIScrollView\'s layer property? But which property would I animate th
This example is base on pt2ph8's obj-c
answer.
https://stackoverflow.com/a/8741283/6113158
var scrollView = UIScrollView()
func animateScrollView(duration: Double, to newBounds: CGRect) {
let animation = CABasicAnimation(keyPath: "bounds")
animation.duration = duration
animation.fromValue = scrollView.bounds
animation.toValue = newBounds
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
scrollView.layer.add(animation, forKey: nil)
scrollView.bounds = newBounds
}