Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to code the LaunchScreen programmatically

Tags:

I am using Xcode7 and Swift with Storyboards. When I open the LaunchScreen.storyboard, and I try to set a Custom Class on it, Xcode complains that one cannot have a custom class on a LaunchScreen storyboard. So my question is, is there any way to programmatically code the LaunchScreen as I would like to avoid having to drag and drop elements on it using IB.

like image 507
Arunabh Das Avatar asked Sep 29 '15 23:09

Arunabh Das


People also ask

How do I create a storyboard in LaunchScreen?

storyboard to configure your launch screen. If your project doesn't contain a default launch screen file, add a launch screen file and set the launch screen file for the target in the project editor. Choose File > New > File. Under User Interface, select Launch Screen, and click Next.

What is LaunchScreen storyboard?

The LaunchScreen. storyboard is an interface builder storyboard file that uses auto-layout and some basic constraints on the controls to adjust the display for all the supported devices. Perform this task in the copy of the DeploymentKitApp in Xcode on your computer.


2 Answers

No, 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.

You can either use a fixed image or you can use a simple storyboard scene using only standard, static UI elements - labels & images.

This storyboard scene is actually loaded and displayed by the OS, so it would be a security risk to allow your code to execute in that context.

like image 160
Paulw11 Avatar answered Nov 20 '22 20:11

Paulw11


This doesn't really count as programmatically since it's just editing the info.plist file but, based on my research I found that there is a new way being introduced especially now with SwiftUI and how it will be replacing StoryBoards that I found here

Picture from the source

Thought I share it here for people searching this topic and come across this post for the first time and who just want a different way than using StoryBoards to create their Launch Screens (like me).

like image 36
shadow of arman Avatar answered Nov 20 '22 20:11

shadow of arman