Hey Brian, another great video!
I was able to refactor the animation code even further to reduce duplication. I did something along the lines of:
fileprivate func shrinkImageView() -> Void {
self.animateEpisodeArtwork {
self.episodePlayerArtwork.transform = CGAffineTransform(scaleX: 0.7, y: 0.7)
}
}
fileprivate func enlargeImageView() -> Void {
self.animateEpisodeArtwork {
self.episodePlayerArtwork.transform = .identity
}
}
fileprivate func animateEpisodeArtwork(withAnimtaion animations: @escaping () -> Void) -> Void {
UIView.animate(withDuration: 0.75, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 1, options: .curveEaseOut, animations: animations, completion: nil)
}