//
//  GifCollectionCell.swift
//  WoWonder
//
//  Created by Muhammad Haris Butt on 11/3/20.
//  Copyright © 2020 ScriptSun. All rights reserved.
//

import UIKit
import WebKit
import SDWebImage

class GifCollectionCell: UICollectionViewCell {

    @IBOutlet weak var gifImage: SDAnimatedImageView!

    override func awakeFromNib() {
        super.awakeFromNib()
    }

    func bindGif(item: GIFData, indexPath: IndexPath) {
        let imageUrl = URL(string: item.images?.downsizedLarge?.url ?? "")
        let indicator = SDWebImageActivityIndicator.medium
        self.gifImage.sd_imageIndicator = indicator
        DispatchQueue.global(qos: .userInteractive).async {
            self.gifImage.sd_setImage(with: imageUrl, placeholderImage: UIImage(named: ""))
        }
    }
    
}
