Launch Screen in SwiftUI

Hi everyone

I have a question about Launch Screen in SwiftUI as Life Cycle in Xcode 12.
What is the best solution for showing a launch screen with 5 seconds delay?

It should be noted, I have change "Launch Screen" attribute in info.plist but I can't find a suitable way for appearing that with 5 seconds delay.

Replies

Hi, the "Launch screen interface file base name" or UILaunchStoryboardName in the Info.plist is for a LaunchScreen.storyboard file. It will show before your app is loaded. Tho as soon as your app is loaded, your ContentView will appear, and if you need to "extend" the launch screen, while other things are loading, I recommend replicating your launch screen in a SwiftUI View, then add it to the top of your UI in a ZStack and wrap your launch view in an if statement for a @State var loading: Bool = true. Once your app data is loaded just call: withAnimation { loading = false }
You absolutely should not design a launch screen with a goal of displaying it for a fixed amount of time, especially a lengthy time like 5 seconds. Users expect apps to launch fast — the Human Interface Guidelines for launch screens are centered around this user experience and expectation:

Downplay launch. People value apps that let them quickly access content and perform tasks. Designing a launch screen that resembles an app’s interface creates the illusion that the app starts instantly. Combined with a fast launch time, this design approach makes your app feel immediately responsive. For a game, the launch screen should transition gracefully into the first screen the game displays.


My understanding, and I am new to Xcode/Swift, is that you can't control how long the LaunchScreen.storyboard is up. As soon as your app is loaded and ready to go it goes to your first scene.

The tutorials I have watched on YouTube...

Matt Heaney Apps
CodeWithChris

...recommend that your launch screen looks as similar to your first scene as possible so that if the launch screen appears for a really short amount of time, like 0.25 of a second, the user doesn't get an ugly view/edit/jump.

Once again, I am new to this as well, so keep that in mind.