Chapter 7: Animating Constraints Challenge

I find that with the solution provided for the challenge does not clearly represent what is asked for. The image is supposed to stay on the screen for 1 second then disappear.
However, since the dismissal animation runs right after the initial show animation is displayed, the length of time that the item stays visible is only 0.2 seconds.
Would it not be better to place the second animation in the completion block of the first, like this:

   UIView.animate(withDuration: 0.8, delay: 0.0, usingSpringWithDamping: 0.4, initialSpringVelocity: 0.0, options: [], animations: {
        conBottom.constant = -imageView.frame.size.height/2
        conWidth.constant = 0.0
    }, completion:{ _ in
        UIView.animate(withDuration: 0.8, delay: 1.0, options: [], animations: {
            conBottom.constant = imageView.frame.height
            conWidth.constant = -50.0
        }, completion: { _ in

This topic was automatically closed after 166 days. New replies are no longer allowed.