In Xcode 11 and later, you might have noticed that with the default files ( AppDelegate.swift, ViewController.swift and a StoryBoard) and a new file is created named as (SceneDelegate.swift).

Now we have a two major files for our apps lifecycle (AppDelegate.swift and SceneDelegate.swift), So from iOS 13 and after, the responsibilities of AppDelegate have been split between AppDelegate and SceneDelegate. let’s take a look into them and try to understand the difference between these two files.

Starting explanation


it uses the protocol UIApplicationDelegate.

UIApplicationDelegate:- It has a set of methods that you use to manage shared behaviors for your app.

Use your app delegate object to handle the following tasks:

  • Initializing your app’s central data structures.
  • Configuring your app’s scenes.
  • Responding to notifications originating from outside the app, such as low-memory warnings, download completion notifications, and more.
  • Responding to events that target the app itself, and are not specific to your app’s scenes, views, or view controllers.
  • Registering for any required services at launch time, such as Apple Push Notification service.

In the default AppDelegate.swift there are three methods that Apple considers to be important that we have to consider and let’s look into them

  • func application(_:didFinishLaunchingWithOptions:) -> Bool

Tells the delegate that the launch process has begun but that state restoration has not yet occurred.

  • func application(_:configurationForConnecting:options:) -> UISceneConfiguration

Returns the configuration data for UIKit to use when creating a new scene, This method is called when ever the application needs a new scene or window to display and need to be obtained.

  • func application(_:didDiscardSceneSessions:)

Tells the delegate that the user closed one or more of the app’s scenes from the app switcher.

Double-press the Home button or swipe up from the bottom of your iPhone and voilá, you’re seeing the windows of the apps that are currently running. This is called the app switcher.


it uses the protocol UISceneDelegate.

UISceneDelegate:- The core methods you use to respond to life-cycle events occurring within a scene.

Use your UISceneDelegate object to manage life-cycle events in one instance of your app's user interface. This interface defines methods for responding to state transitions that affect the scene, including when the scene enters the foreground and becomes active, and when it enters the background.

The default methods that can be seen in SceneDelegate are:

  • scene(_:willConnectTo:options:)

This is the first method called in UISceneSession life cycle. This method is called when your app creates or restores an instance of your user interface.

  • sceneDidDisconnect(_:)

Tells the delegate that UIKit removed a scene from your app. This doesn’t meant that the app is killed or not running, but just the scene is disconnected from the session and is not active. This method can be used to discard any resources that aren’t used anymore.

  • sceneWillEnterForeground(_:)

Tells the delegate that the scene is about to begin running in the foreground and become visible to the user.

  • sceneDidBecomeActive(_:)

This method is called right after the WillEnterForeground method and Tells the delegate that the scene became active and is now responding to user events.

  • sceneWillResignActive(_:)

Tells the delegate that the scene is about to resign the active state and stop responding to user events (when app become in background mode).

  • sceneDidEnterBackground(_:)

Tells the delegate that the scene is running in the background and is no longer onscreen.


The main reason for Apple to add UISceneDelegate to iOS 13 was to split responsibilities between AppDelegate and SceneDelegate, AppDelegate’s roles is for handling application-level events, like app launch and the SceneDelegate’s role is for scene lifecycle events like scene creation, destruction and handling background and foreground modes.




iOS Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Never Forget to Update Your App UI Again

How To Implement AR Quick Look in Your App

SwiftUI Tutorial on Localization

Device Selection for iOS App Testing

Understanding contact tracing technology or Exposure Notification System — For Users and…

Automatically Pixelate Faces on iOS using Native Swift Code for Face Detection

The making of the STEMpump App

SwiftUI LazyHStack vs HStack

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
ahmad elkhwaga

ahmad elkhwaga

iOS Developer

More from Medium

BlogPost #1

Meet Millie

Where should we land next?

A Letter To Next Year’s Freshmen

Hello Everyone I'm here to tell you the basis of all you need to know about DOAIBU TOKEN which is…