Beginning iOS Animations · Animating View Properties |

This is a companion discussion topic for the original entry at

What’s the purpose of creating a temporary view to slide in for the animation? It seems to work fine if you just animate the background image transition in method fade inside of a UIView.animate. I can’t tell the difference when you do this: += 20
  let origSize = bgImageView.bounds.width
  bgImageView.bounds.size.width = bgImageView.bounds.width * 1.3

  UIView.animate(withDuration: 0.5, delay: 0, options: .curveEaseIn, animations: {
        self.bgImageView.image = toImage
        self.bgImageView.bounds.size.width = origSize -= 20
    }) { (_) in

The temp view lets us create a crossfade effect. In your example, you only see one image at a time. If you use the temp view like we do in the video, the background images will both be partially visible in the middle of the animation:

To see that in action, try making the animation longer, or do a screen recording and step through the frames of the video.