DEV Community

Sagar Unagar
Sagar Unagar

Posted on

Basic structure of SwiftUI project

Apple introduced SwiftUI in WWDC 2019 that enabled a new way to create user-interface of your iOS app.

Whenever you create your single view app using SwiftUI, You will get the following basic template of your app.

Alt Text

SwiftUI default project structure

Let's discuss more about this all files,

AppDelegate.swift
After SwiftUI introduced, Appdelegate is only responsible for setting up external dependency and managing application data(ex. coredata).

SceneDelegate.swift
This is something new you can see in a project that is created using SwiftUI. SeceneDelegate is responsible for managing the way your app is shown. This contains the app transition methods that handle the app enter in the foreground, enter in the background, etc.

ContentView.swift
This is an initial view of your application. In this file, you can create your app interface using a declarative way. This is equivalent to ViewController that is being generated in the project that is created without using SwiftUI.

Assets.assets
As usual as previous, Assets contain all the images and colors that are used in our project.

LaunchScree.storyboard
This screen is displayed as a launch screen(splash screen) of your app. Nothing changes the way we setting up the launch screen previously.

Info.plist
This is a property list file that states all the system related settings like app name, app version, build number, etc.

Preview Contain
This folder includes one another asset catalog that is used at preview time in canvas.

Thanks for reading, Happy Holidays 🎅🎄

Oldest comments (0)