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.

Overview

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.

Topics

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.

UIApplication

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

UIApplicationDelegate

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

Scenes

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

Device Environment

UIDevice

A representation of the current device.

UIStatusBarManager

An object describing the configuration of the status bar.

Beta

Adaptivity

Responding to Changing Display Modes on Apple TV

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

UITraitCollection

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

UITraitEnvironment

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

UIAdaptivePresentationControllerDelegate

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

UIContentContainer

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

Guided Access

UIGuidedAccessRestrictionDelegate

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

UIGuidedAccessRestrictionStateForIdentifier

Returns the restriction state for the specified guided access restriction.

Architecture

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.

UIApplicationMain

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.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software