개발/swift

Swift scene delegate vs app delegate

lemonade 2020. 12. 16. 10:00
반응형

Difference between scene delegate and app delegate

 

 

From Xcode 11 you might have noticed a new named SceneDelegate.swift.

 

In prior iOS 13, There is only AppDelegate file.

 

AppDelegate is the main entry of the app and handles app states.

 

But from iOS 13, the responsibilites of AppDelegate have been split between AppDelegate and SceneDelegate.

 

This is the for support new multi-window support feature which is introduced with iPad-OS.

 

  • App Delegate

AppDelegate is still the main point of entry for an application in ios 13. AppDelegate methods are called for application level lifecycle events. 

 

 

  • Scene Delegate

From iOS 13 and later, SceneDelegate get some responsibilites from AppDelegate. UIWindow from AppDelegate is replaced by UIScene in SceneDelegate. 

 

 

 

Scene delegate is added to ios 13 for handling multi-window application. If you don't need to handle multi-window or need to support older version than ios 13, you don't have to use scene delegate. AppDelegate is responsible for handling application-level events, SceneDelegate is responsible for scene lifecycle events like scene creation, destruction and state restoration of a UISceneSession.

 

반응형
그리드형