GifyGif: Hud with animated image

sunita kumari
2 min readJul 30, 2019

--

Hey Guys, I am back with one more story. In this story also, I’ll discuss one problem which I faced in one of my recent project. So, let’s start

Problem: My requirement was to show loader with GIf image and this GIF image changes with screen. So basically, requirement was to have different hud for different screens

I found many awesome libraries to accomplish this, limitation with these libraries is, we have to provide Gif image and other customisable things at the start of app (may be in BaseViewController) and if I want to change Hud size somewhere in between app, then I need to make huge changes(or hud shows the same size ).

So I thought of writing this myself which I’ll explain. First see the result of my implementation below

Hud with GIf Image

Here is the file that do everything for us.

Simply drag and drop this two files to your project and start using it. You can write code to show and hide hud in BaseViewComtroller (like I did). Find below

How to show and hide hud ?

GifyGifHud.swift has GifHUDOptions(). These options are customisable but only one time . So these customisations you can do at the start of app may be in AppDelegate.swift or LaunchHelper.swift (where ever you like).

and GifyGifHud.swift has hudSize, imageName and hudBackground as public property and could be change anytime while using GifyGifHud in app. See how I am changing them below

How to customize GifyGif Hud ?

Checkout the repo here and play around it.

--

--