Matt
Matt

Reputation: 13

SwiftGif: This image named "one" does not exist

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.

Xcode Navigator

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

Answers (1)

Aaron Brager
Aaron Brager

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

Related Questions