App and Environment

Manage life-cycle events and your app’s UI scenes, and get information about traits and the environment in which your app runs.


In iOS 13 and later, the user can create and manage multiple instances of your app's user interface simultaneously, and switch between them using the app switcher. On iPad, the user can also display multiple instances of your app side by side. Each instance of your UI displays different content, or displays the same content in a different way. For example, the user can display one instance of the Calendar app showing a specific day, and another showing an entire month.

UIKit communicates details about the current environment using trait collections, which reflect a combination of device settings, interface settings, and user preferences. For example, you use traits to detect whether Dark Mode is active for the current view or view controller. Consult the current trait collection of your UIView or UIViewController object when you want to customize its contents based on the current environment. Adopt the UITraitEnvironment protocol in other objects when you want them to receive trait notification changes.


Life Cycle

Managing Your App's Life Cycle

Respond to system notifications when your app is in the foreground or background, and handle other significant system-related events.

Responding to the Launch of Your App

Initialize your app’s data structures, prepare your app to run, and respond to any launch-time requests from the system.

class UIApplication

The centralized point of control and coordination for apps running in iOS.

protocol UIApplicationDelegate

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


Manage multiple instances of your app’s UI simultaneously, and direct resources to the appropriate instance of your UI.

Device Environment

class UIDevice

A representation of the current device.

class UIStatusBarManager

An object describing the configuration of the status bar.


Responding to Changing Display Modes on Apple TV

Change images and resources dynamically when the screen gamut on your device changes.

class UITraitCollection

The iOS interface environment for your app, defined by traits such as horizontal and vertical size class, display scale, and user interface idiom.

protocol UITraitEnvironment

A set of methods that makes the iOS interface environment available to your app.

protocol UIAdaptivePresentationControllerDelegate

A set of methods that, in conjunction with a presentation controller, determine how to respond to trait changes in your app.

protocol UIContentContainer

A set of methods for adapting the contents of your view controllers to size and trait changes.

Guided Access

protocol UIGuidedAccessRestrictionDelegate

A set of methods you use to add custom restrictions for the Guided Access feature in iOS.

static func guidedAccessRestrictionState(forIdentifier: String) -> UIAccessibility.GuidedAccessRestrictionState

Returns the restriction state for the specified guided access restriction.


Updating Your App from 32-Bit to 64-Bit Architecture

Ensure that your app behaves as expected by adapting it to support later versions of the operating system.

func UIApplicationMain(Int32, UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>, String?, String?) -> Int32

Creates the application object and the application delegate and sets up the event cycle.

See Also

App Structure

Documents, Data, and Pasteboard

Organize your app's data and share that data on the pasteboard.

Resource Management

Manage the images, strings, storyboards, and nib files that you use to implement your app's interface.

App Extensions

Extend your app's basic functionality to other parts of the system.

Inter-Process Communication

Share data through Handoff, support universal links into your app's content, and display activity-based services to the user.

Mac Catalyst

Create a version of your iPad app that users can run on a Mac device.