When Apple introduced SwiftUI at WWDC 2019 it seemed like the beginning of the end for storyboards. Unfortunately you still needed a launch storyboard for the system to show while your app launches. That changed with Xcode 12 and iOS 14.
When iOS launches your app it shows the launch screen while your app is loading. A well behaved app should launch in less than 400ms at which point the main user interface replaces the launch screen image:
Since iOS 8, the recommended way to create the launch image was to use a launch screen storyboard. This is flexible enough that a single storyboard can adapt to different device sizes and environments. (Apple deprecated static launch images in the asset catalog in June 2020).
If you’ve switched to SwiftUI or simply don’t like storyboards you might be wishing you could ditch the last remaining storyboard in your project. Starting with iOS 14 that becomes possible (assuming you can drop support for iOS 13).
Defining A Launch Screen
Apple wants you to keep your launch image simple. It should look like the first screen of your app so the user sees a smooth transition during launch. If you follow that approach it’s likely you can get away with not using a launch storyboard and define the launch screen in the
Info.plist file for the target.
For example, to create the launch screen I showed above with a purple background (defined in the asset catalog) and a navigation bar:
Here’s a summary of the settings keys you can use to create your launch screen:
- Launch Screen (UILaunchScreen) The top-level key for the dictionary that defines the launch screen. Replaces the
- Background color (UIColorName) Background color of the launch screen. A String value that matches a color in your asset catalog. If you don’t define a background color the launch screen uses the
- Image Name (UIImageName) An image to display. A String value that matches an image in your asset catalog.
- Image respects safe area insets (UIImageRespectsSafeAreaInsets) A Boolean to control if the image should stay inside the safe area.
- Show Navigation bar (UINavigationBar) Include this key to have the system show a navigation bar during launch.
- Show Tab bar (UITabBar) Include this key to have the system show a tab bar during launch.
- Show Toolbar (UIToolbar) Include this key to have the system show a navigation bar during launch.
- If you create a new Xcode project you only get the launch screen settings if you use the SwiftUI app lifecycle. In all other cases Xcode still includes a launch storyboard but there is nothing stopping you from switching if you want. It works for UIKit projects and SwiftUI projects with the UIKit app delegate.
- The navigation, tab and toolbar keys are all dictionaries that can optionally include an image name key (UIImageName) to use as a custom image for the bar.
- The use of the asset catalog for the background color and images allows you to create variations for light, dark and high contrast modes and use image slicing if necessary.
- The background color will show through any images that are transparent.
A more complicated example:
Launch Screens for URL Schemes
If you need it you can create different launch screen definitions for each URL scheme that launches your app. (You can do something similar with launch storyboards using the
UILaunchStoryboards key). Use the
UILaunchScreens key instead of
This is a dictionary that contains an array of launch screen definitions. Each definition has an identifier. The “Default Screen Identifier” sets the default launch screen. The “URL to Launch Screen Associations” dictionary maps between URL schemes and the launch screen identifier.
In my example above I have a URL scheme defined for my app with the identifier “facts”:
In the launch screen settings I have this mapped to the “EditScreen” launch screen.
Should You Migrate From A Launch Storyboard?
There’s no need to switch if you already have a launch storyboard for your project. Launch storyboards still work fine with iOS 14 and you may need the greater flexibility. The new launch screen keys only work for iOS 14 so if you need to deploy to iOS 13 or earlier stick with a launch storyboard.
If you do switch, remember to delete the “Launch screen interface file base name” (
UILaunchStoryboardName) key from the
Info.plist file of the target or the system will ignore the