I have an app with 3 views, 2 of them are tableViews (lists) and on the third view Im trying load gifs through passing data (text and gifs), different for each item in the list.
I have found an extension to play gifs called SwiftGif, which works great when using in ordinary viewControllers, but the gif is not moving when passing data between tableViews.
SwiftGif contains function:
extension UIImageView {
public func loadGif(name: String) {
DispatchQueue.global().async {
let image = UIImage.gif(name: name)
DispatchQueue.main.async {
self.image = image
}
}
}
And my ThirdView.swift file contains:
import Foundation
import UIKit
import ImageIO
let name = String()
var gifs = UIImage.gif(name: name)
struct IngredientsAndDirections {
var ThirdViewArray = [String]()
var Pic = [gifs]
}
But I can't figure out how to call the loadGif function on the array of gifs to make my gifs moving.
Any suggestions please?
In case anyone is looking for a solution (Swift 4).