Animated Launch Screen

Basically when we want to set an image for LaunchScreen then we use LaunchScreen.storyboard for setting an image, but as this file does not have any class file (eg .swift or .h & .m) so we can not write code for animating that image at runtime. To achieve this we need to use main.storyboard

Steps to implement animated Launch Screen : –

1) Click on project name on ProjectNavigatorPanel -> go to Target.

2) Scroll down  to “Main Interface” -> click down arrow -> change  LaunchScreen.storyboard to Main.

3) Go to Main.storyboard -> Select your view controller for which you want to set animated Launch Screen.

4) Select your view controller -> click on Editor on top menu bar -> Embed In -> select Navigation Controller

5) Set Navigation Controller as Initial ViewController of your project.

Now create a class for writing code of animation and connect it to view controller on Main.storyboard , Once the animation is done you can push a view controller to next view controller programmatically.

 

NOTE : You can write any type of animation code in that class file (eg .swift) as per your requirements. I have used .gif image for LaunchScreen using code from “Swift+Gif.swift” file.Have a fun with animation Code Here