         photoImageView.contentMode = .scaleAspectFill
         photoImageView.clipsToBounds = true
         photoImageView.backgroundColor = UIColor.lightGray
+        photoImageView.isUserInteractionEnabled = true
         
         heartButton = UIButton()
         heartButton.addTarget(self, action: #selector(self.didTapHeart), for: .touchUpInside)

        commentCountLabel.numberOfLines = 0
        commentCountLabel.font = UIFont.systemFont(ofSize: 12)
        commentCountLabel.textColor = secondaryColor
        
        timeLabel = UILabel()
        timeLabel.numberOfLines = 0
        timeLabel.font = UIFont.systemFont(ofSize: 8)
        timeLabel.textColor = secondaryColor
        
        contentView.addSubview(photoImageView)
        contentView.addSubview(heartButton)

extension PostListCollectionCell {
    
    func didTapHeart() {
        delegate?.didTapHeart(cell: self)
    }
    
    func didTapComment() {
        delegate?.didTapComment(cell: self)
    }
    
    func didTapPhoto() {
        animateHeartButton { }
        showAnimatedHeart {
            self.delegate?.didTapPhoto(cell: self)
        }
    }
    
    func didTapCommentCount() {
        delegate?.didTapCommentCount(cell: self)
    }
    
    func didTapLikeCount() {
        delegate?.didTapLikeCount(cell: self)
    }
}

extension PostListCollectionCell {
    
    func showAnimatedHeart(completion: @escaping () -> Void) {
        let heart = SpringImageView(image: #imageLiteral(resourceName: "heart_pink"))
        heart.frame = CGRect(x: 0, y: 0, width: 48, height: 48)
        photoImageView.addSubviewAtCenter(heart)
        heart.autohide = true
        heart.autostart = false
        heart.animation = "pop"
        heart.duration = 1.0
        heart.animateToNext {
            heart.animation = "fadeOut"
            heart.duration = 0.5
            heart.animateToNext {
                heart.removeFromSuperview()
                completion()
            }
        }
    }
    
    func animateHeartButton(completion: @escaping () -> Void) {
        heartButton.isHidden = true
        let heart = SpringImageView(image: #imageLiteral(resourceName: "heart_pink"))
        heart.frame = heartButton.frame
        contentView.addSubview(heart)
        
        heart.autohide = true
        heart.autostart = false
        heart.animation = "pop"
        heart.duration = 1.0
        heart.animateToNext {
            heart.removeFromSuperview()
            self.heartButton.setImage(#imageLiteral(resourceName: "heart_pink"), for: .normal)
            self.heartButton.isHidden = false
            completion()
        }
    }
}

extension PostListCollectionCell {
       
    func toggleHeart(liked: Bool, completion: @escaping() -> Void) {
        if liked {
            heartButton.setImage(#imageLiteral(resourceName: "heart"), for: .normal)
            completion()

        } else {
            animateHeartButton { }
            showAnimatedHeart {
                completion()
            }
        }
    }
}

