A set of methods that you use to manage shared behaviors for your app.
- iOS 2.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
Your app delegate object manages your app’s shared behaviors. The app delegate is effectively the root object of your app, and it works in conjunction with
UIApplication to manage some interactions with the system. Like the
UIApplication object, UIKit creates your app delegate object early in your app’s launch cycle so it is always present.
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.
For more information about how you use the app delegate object to initialize your app at launch time, see Responding to the Launch of Your App.
Life Cycle Management in iOS 12 and Earlier
In iOS 12 and earlier, you use your app delegate to manage major life cycle events in your app. Specifically, you use methods of the app delegate to update the state of your app when it enters the foreground or moves to the background.
For information on what to do when your app enters the foreground, see Preparing Your UI to Run in the Foreground.
For information on what to do when your app enters the background, see Preparing Your UI to Run in the Background.
For general information about the life cycle of your app, see Managing Your App's Life Cycle.