4

I have an app that uses some GIF files using SwiftyGif (a 3rd party API that adds GIF support to the class).

The problem is that the GIF size should be 30x30. I've added a 30x30 file to the project but I need the @2x and @3x files. As you may know, Xcode has a Images.xcassets folder that's contains @1x, @2x, @3x files and it has an algorithm the chooses the appropriate file.

I've tried to add the GIF file to this folder but it's not possible, so how can I use the @1x, @2x and @3x method with a GIF file?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
FS.O5
  • 297
  • 1
  • 4
  • 13

1 Answers1

4

You have to manually add the folder with .imageset extension. Right click on Assets.xcassets folder and go to location in finder. Add the asset folder with .imageset extensionn. Drop the 1x, 2x and 3x files to that folder. Add one file Contents.json, and add the file names in that file.

{
  "images" : [
    {
      "idiom" : "universal",
      "scale" : "1x",
      "filename" : "yourfile@1x.gif"
    },
    {
      "idiom" : "universal",
      "scale" : "2x",
      "filename" : "yourfile@2x.gif"
    },
    {
      "idiom" : "universal",
      "scale" : "3x",
      "filename" : "yourfile@3x.gif"
    }
  ],
  "info" : {
    "author" : "xcode",
    "version" : "1"
  }
}
Mohammad Sadiq
  • 5,070
  • 28
  • 29