How to set up your SwiftUI Project with AppDelegate and SceneDelegate

As Apple released the SwiftUI Lifecycle, AppDelegate or SceneDelegate are no longer automatically created in the project. In fact, you can do almost anything with Notification Event without having to use AppDelegate or SceneDelegate. Nevertheless, if there is AppDelegate or SceneDelegate, the advantage is that it is easier to organize the code.

Create SwiftUI Project

Create SwiftUI Project

Now you will see these files.

Your Created Project

You can check there’s no more AppDelegate and SceneDelegate.

Implement AppDelegate

[1] Create AppDelegate.swift


[2] Add boilerplate code to AppDelegate


[3] Attach AppDelegate on your App

Your App

[4] Test

Test Code

Run the application and you will see App Did Launch is printed out.

Implement SceneDelegate

[1] Create SceneDelegate File

Create SceneDelegate.swift

[2] Add boilerplate code to SceneDelegate


[3] Connect your SceneDelegate in your AppDelegate

Connect SceneDelegate.swift in AppDelegate.swift

[4] Test

Scene Delegate

Now you will see “SceneDelegate is connected!” message is printed out in the console!


Create AppDelegate

  1. Create AppDelegate.swift
  2. Add Boilerplate Code
  3. Attach it on App with @UIApplicationDelegateAdaptor

Create SceneDelegate

  1. Create SceneDelegate.swift
  2. Add Boilerplate Code
  3. Connect it through func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
KD Knowledge Diet

Software Engineer, Mobile Developer living in Seoul. I hate people using difficult words. Why not using simple words? Keep It Simple Stupid!