Contents

UIApplicationDelegate

A set of methods to manage shared behaviors for your app.

Declaration

@MainActor protocol UIApplicationDelegate : NSObjectProtocol

Mentioned in

Overview

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’s 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 aren’t 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.

Topics

Initializing the app

Configuring and discarding scenes

Responding to app life-cycle events

Responding to environment changes

Managing app state restoration

Downloading data in the background

Handling remote notification registration

Continuing user activity and handling quick actions

Interacting with WatchKit

Interacting with HealthKit

Opening a URL-specified resource

Disallowing specified app extension types

Handling SiriKit intents

Handling CloudKit invitations

Localizing keyboard shortcuts

Managing interface geometry

Providing a window for storyboarding

Providing the main entry point

Deprecated

See Also

Life cycle