I have this gif into my assets file 
The name of the assets is loading_apple but when I add the following code I get a nullpointer exception error:
let img = UIImage (named: "loading_apple")
So how can I show this gif ? :(
Hope someone can help me.
I would recommend breaking out the frames of that gif and use
animatedImageNamed:duration:- you can name them all the similar name with a number change at the end. For instance:loading-1.pngloading-2.pngloading-3.pngetc.Xcode will recognize you want multiple images and will play those through in order.
Look at THIS