I have a custom UICollectionViewCell within a UICollectionView that animates correctly when the collection view is initially displayed. However when I segue into a new UIViewController and back to the original one, the animation stop.
class EmptyDishesCollectionViewCell: UICollectionViewCell {
  @IBOutlet weak var plateImage: UIImageView!
  @IBOutlet weak var knifeImage: UIImageView!
  @IBOutlet weak var forkImage: UIImageView!
  @IBOutlet weak var emptyBackgroundView: UIView!
  @IBOutlet weak var plateHeight: NSLayoutConstraint!
  @IBOutlet weak var plateWidth: NSLayoutConstraint!
  override func awakeFromNib() {
    super.awakeFromNib()
    setupBorders()
    setupImages()
    beginAnimation()
    setShadow()
  }
  func setupBorders() {
    self.emptyBackgroundView.layer.cornerRadius = 3.0
    self.emptyBackgroundView.backgroundColor = UIColor.white
  }
  func setupImages() {
    self.plateImage.tintColor = UIColor.projectBackgroundSuperLightGray
    self.forkImage.tintColor = UIColor.projectBackgroundSuperLightGray
    self.knifeImage.tintColor = UIColor.projectBackgroundSuperLightGray
  }
  func beginAnimation() {
    UIView.animateKeyframes(withDuration: 2.4, delay: 0.0, options: [.calculationModeLinear, .repeat, .autoreverse], animations: {
      UIView.addKeyframe(withRelativeStartTime: 0, relativeDuration: 2/5, animations: {
        let moveLeft = CGAffineTransform(translationX: -5.0, y: 0.0)
        let moveRight = CGAffineTransform(translationX: 5.0, y: 0.0)
        let rotate = CGAffineTransform(rotationAngle: .pi / 5.0)
        self.forkImage.transform = moveLeft
        self.knifeImage.transform = moveRight
        self.plateImage.transform = rotate
      })
      UIView.addKeyframe(withRelativeStartTime: 1/3, relativeDuration: 1/5, animations: {
//        let wait = CGAffineTransform(translationX: -5.0, y: 0.0)
//        self.forkImage.transform = wait
      })
      UIView.addKeyframe(withRelativeStartTime: 2/3, relativeDuration: 2/5, animations: {
        self.forkImage.transform = .identity
        self.knifeImage.transform = .identity
        self.plateImage.transform = .identity
      })
    })
  }
}
I'm assuming when a view is transitioned out of sight, the animation automatically stops, however when it's put back into view it needs to be kicked off again manually.
so naturally I thought putting the animation block into didMoveToWindow would fix it, but it was a no go. 
Any help would be appreciated
