Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 18.104.22.168 release ready!
Owner and Founder. Opencart
If you have created a project on Xcode 11 and above you have noticed h new file created as SceneDelegate.swift. Let’s check below the difference between Scene Delegate and App Delegate.
If we create a new project before xcode 11, it will create some default files, as shown in below image.
From Xcode 11 onwards you might have noticed that along with the default files, it will create a new file as SceneDelegate.swift. As shown in the below image.
In apps prior to iOS 13, AppDelegate is the main entry point of the app, and in it, the application launches, and it handles app background and foreground states.
But from iOS 13 the responsibilities of app delegates have been split between AppDelegate and SceneDelegate.
That’s how the new multi-window support feature is introduced in iPad OS.
Even after iOS 13, the AppDelegate is still the main entry point of an application.
By default AppDelegate.swift have three main methods.
In iOS 12 or earlier, you might have used this method to create and configure a UIWindow object and assigned a UIViewController instance to the window to make it appear.
If your app is using scenes, your AppDelegate is no longer responsible for doing this.
Since your application can now have multiple windows or UISceneSessions active, it doesn’t make much sense to manage a single-window object in the AppDelegate
Whenever the application needs a new scene or window.
Whenever the user discards a scene by swiping it from the multitasking window or if discarded programmatically.
This method is called for every discarded scene shortly after the (_:didFinishLaunchingwithOptions:) method is called if the app isn’t running when the user discards the scene.
In addition to these methods, AppDelegate can still handle URLs, cache memory, app termination, push notifications, location services, and many more.
From iOS 13, SceneDelegate takes up some responsibilities from AppDelegate, particularly UIWindow in AppDelegate is now UIScene in SceneDelegate.
What is displaying on the screen is the responsibility of SceneDelegate. There are 6 default functions in SceneDelegate.
It will create a new window, sets the root view controller, and makes this window the key widow that will be displayed.
When the app becomes active for the first time or when transitions from background to foreground.
When the scene has moved from an inactive state to an active state.
When the scene will move from an active state to an inactive state.
This may occur due to temporary interruptions (ex. an incoming phone call).
When the scene transitions from the foreground to the background.
While releasing the scene by the system.
The scene may re-connect later, as its session was not necessarily discarded (see application:didDiscardSceneSessions instead).
Hope the difference between Scene Delegate and App Delegate is clear now, if you still have any doubt or query you can let me know over the comment section.
Thanks for reading 🙂
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.