Reputation: 13
Followed the instructions from video: https://www.youtube.com/watch?v=Rm61mxcSD4U&t=95s
Added my animated GIF file, one.GIF
.
Tried running, but get error:
SwiftGif: This image named "one" does not exist.
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var gifView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
gifView.loadGif(name: "one")
}
}
Upvotes: 1
Views: 455
Reputation: 66242
In your file one.GIF
, the extension is all uppercase. However, you can see in the source code that it's looking for lowercase .gif
.
You need to rename one.GIF
to one.gif
.
From Getting References to Bundle Resources: The Bundle Search Pattern:
Important: The bundle interfaces consider case when searching for resource files in the bundle directory. This case-sensitive search occurs even on file systems (such as HFS+) that are not case sensitive when it comes to file names.
Upvotes: 1