Custom animation in Launch Screen - ios

I have created a new project in Xcode 7 using Swift. I noticed that the launch screen is stored in the storyboard file.
So I think if it could be customised by referring it to my CustomLauchScreenViewController. However, when I set the custom class name in LaunchScreen.storyboard, it throws an error:
Launch screens may not set custom classnames
So what is the best way to customize the LaunchScreen? I intend to use the LaunchScreen to load some data before launching the main screen.

That's not the purpose of the launch screen. What you can do however if have your first initial viewController 'act' as a launch screen. Just have it display the same image as the launch image and do what you need to do in there. Once you are done, move to your main viewController from there.

The launch screen is shown before your app starts executing in order to provide a transition from the Springboard to your app while it is loading. According to Apple interface guidelines,
A launch file (or image) provides a simple placeholder image that iOS displays when your app starts up. The placeholder image gives users the impression that your app is fast and responsive because it appears instantly and is quickly replaced by the first screen of your app.
To achieve a transition, remove the class from LaunchScreen.storyboard and set it similar to 0% loading transition. Create a new controller in your Main.storyboard and set CustomLauchScreenViewController there and assign this as initial view controller.
Set CustomLauchScreenViewController as your root view controller in your app delegate. When launch screen will be replaced by your this controller, transition is too smooth to feel any difference. After loading the data, change your root view controller to required View Controller.

Related

Gif in launch screen

Im using this Class for gifs:
https://github.com/swiftgif/SwiftGif/blob/master/SwiftGifCommon/UIImage%2BGif.swift
But now, i want to add a gif to the launchscreen and since i can't set custom classes here, i don't know, how to do that. Any Ideas?
You can not use Custom classes in Launchscreen. Create a UIViewController and mark it as an entry point. Play the gif there and after a certain time you perform a segue to other ViewController. This little trick will work
UPDATED
In order to implement the logo animation we’ll need to do two things:
Add the first frame of the GIF as a static image in the launch screen
When the app launches add a view in the root view controller that
loads the animated GIF at the same spot that we’ve put the static
image in the launch screen
This way, when the app launches the user will get the impression that the launch screen is animating.
Have a look at Animated launch screen using a GIF in iOS

Present a view controller just before the UIDocumentBrowserViewController to be shown at launch

Here are the facts: I have a document based app using iOS 11's UIDocumentBrowserViewController. And as noted in the documentation, I set it as my root view controller:
Always assign the document browser as your app's root view controller. Don't place the document browser in a navigation controller, tab bar, or split view, and don't present the document browser modally.
I have an animated launch screen in another view controller and in an usual app, it is the root controller. But here it can't be...
So my problem is that I can't achieve the smooth transition between the launch screen and the animated splash view controller.
I've tried to perform the segue unanimated to the splash in the viewWillAppear and in the viewDidLoad of the browser view controller... But between the launch screen and the splash screen, I have a glimpse of 1 second or two on the browser...
I even tried to present it over the browser view controller inside the applicationDidFinishLaunching but I have the same result...
So if anyone has a clean way of doing it, I'm interested. I would not like ending by inserting savagely views over the browser, if you see what I mean. 🤔
Thanks in advance.
Please watch the Managing Documents in your iOS apps WWDC session tomorrow. This restriction is about to get lifted. You can present the document browser modally full-screen over your splash screen, as long as you do not dismiss it afterwards (it needs to be at the "root" of your app for usability reasons). Don't forget to release any memory used by your splash screen once you present the browser.
However, I think a cleaner design would be to present your splash screen over the browser in viewWillAppear, as you suggest. If that doesn't work, could you please file a bug at bugreport.apple.com? Thanks.

Activity View Indicator isn't animating at LaunchScreen.storyboard

I want to use Activity View Indicator on my app while it's loading, so I have LaunchScreen.storyboard.
I use "Behaviour - Animating" on my AVI, but it is not animating.
When I use Act.V.Indic. not in LaunchScreen - it is animating.
The LaunchScreen storyboard is static. iOS actually creates an image from the LaunchScreen and displays that image. It is impossible to have any dynamic or animated content in a LaunchScreen storyboard.
If your app takes time to load, then your app should display another screen as soon as it starts and that screen should show the activity indicator view.
Launch screens are static. Even though you set it to animating, it won't animate, simply because it can't. Think of them as outlines for your launch images. iOS will generate an image from them, that'll be shown to the user. They are a more convenient way of generating launch screens but aren't interactive or dynamic.

What is the difference between launchscreen.storyboard and main.storyboard

I googled the two word together but could not find anything. I have never used it. Is there any necessity for it although we have main.storyboard.
They are two completely different things. The launch screen is what first appears when the user taps the app icon before the app is finished launching. It shows a single, static screen. It can't be dynamic and it can't use any custom classes or code. It's the replacement for launch images.
The main storyboard is what your app actually displays when the app is running. It contains your app, code, and logic.
When you run your program in Xcode simulator gets open and your application gets open then you can see black white screen for fews seconds before actuals developed screen
Blank screen - LaunchScreen.storyboard - Non editable
Developed Screen - Main.storyboard - Editable for which you can able to make changes
The launchscreen.storyboard (basically a loading screen) is what comes up when the user loads the application. How long it appears to the user depends on how long it takes for the user to load your application. You can change the duration of the launchscreen.storyboard but it is not recommended, generally users want the app to load as fast as possible
The main.storyboard is appears onto the screen AFTER the launchscreen.storyboard
When the app is being running in the Simulator/iPhone the 1st screen which is loaded in the memory after the user click the app icon is LAUNCHSCREEN.STORYBOARD and after the app is fully loaded, this is the time where MAIN.STORYBOARD comes into play, this is the screen which is editable you can add actions, outlets , other screen inside a View Controller, so the main work is being done inside MAIN.STORYBOARD and LAUNCHSCREEN.STORYBOARD is being used to display something static while the app gets fully loaded.

Custom File for Launch Screen

I'm making an app where I need to program the launch screen, more than just placing images on the .xib file. Is there a way to connect a swift file to the launch screen so I can add animations?
I was thinking of doing something like Supercell does for Clash of Clans, where there's a loading bar and a short message users can look at while the game loads.
So is it possible to connect a swift class file to the .xib launch screen and how would one go about doing it?
Thanks
Unfortunately your app cannot process or display any animations during this launch screen. This is because the app is still technically loading.
Also it contradicts Apple's design guidelines for launch screens:
Design a plain launch image that improves the user experience. In
particular, the launch image isn’t an opportunity to provide:
An “app entry experience,” such as a splash screen
An About window
Branding elements, unless they are a static part of your app’s first
screen
What you can do is add your own custom "animation screen" as the entry point to your Storyboard (or just root view) and create animations as you normally would through a View Controller swift file.

Resources