paint-brush
How to Add a SplashScreen in SwiftUI by@vaibhavdwivedi
267 reads

How to Add a SplashScreen in SwiftUI

by VaibhavOctober 10th, 2024
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In the fifth post of the #30DaysOfSwift series, we’ll focus on creating a Launch Screen for your app. This is the screen users see first when your app is loading, and it's a great way to introduce your app’s brand.
featured image - How to Add a SplashScreen in SwiftUI
Vaibhav HackerNoon profile picture

Day 5: First Impressions Matter! 🚀

In the fifth post of the #30DaysOfSwift series, we’ll focus on creating a Launch Screen for your app. This is the screen users see first when your app is loading, and it's a great way to introduce your app’s brand.

Why Use a SplashScreen?

It’s the first thing users see when they open your app. A launch screen makes the app feel more responsive during the loading process. Here’s how you can quickly add a launch screen using LaunchScreen.storyboard in Xcode:


Image description

Steps to Add a Launch Screen:

1. Create a New Storyboard File:

  • Right-click on your project, and select New File.
  • Choose Storyboard, and name it LaunchScreen.storyboard.


2. Design the Launch Screen:

  • Open LaunchScreen.storyboard.
  • Drag in UI elements like an image or label that represents your app's logo or name.
  • Make sure to keep the design simple and aligned with your brand.


3. Set the Launch Screen in Xcode:

  • In the Project Navigator, go to the root of your project.
  • Under the General tab, scroll to the App Icons and Launch Images section.
  • In the Launch Screen File field, type LaunchScreen (or select it from the dropdown).


4. Test Your Launch Screen:

  • Run your app on a simulator or device, and you’ll see the launch screen appear before transitioning to your app’s main view.


How does it look? Let me know :)


Happy Coding!