UIView animateWithDuration is too fast
Try it :
override func viewDidAppear(_ animated: Bool) {
//You should not edit directly the frame here, or the change will be committed ASAP. Frame does not act like constraints.
// create the new frame
var newFrame = self.shapeLayer.frame
newFrame.size.height += 400.0
UIView.animate(withDuration: 5.0, delay: 3.0, options: .curveEaseOut, animations: {
//assign the new frame in the animation block
self.shapeLayer.frame = newFrame
}, completion: { finished in
})
}
Maybe you should try CABasicAnimation
let fromValue = view2.layer.bounds.height
let toValue = view2.layer.bounds.height + 50
CATransaction.setDisableActions(true) //Not necessary
view2.layer.bounds.size.height = toValue
let positionAnimation = CABasicAnimation(keyPath:"bounds.size.height")
positionAnimation.fromValue = fromValue
positionAnimation.toValue = toValue
positionAnimation.duration = 1
view2.layer.addAnimation(positionAnimation, forKey: "bounds")