Member-only story
App State, Application life cycle, View State
2 min readJan 6, 2025
App States
- Not Running
- The app is not in memory. It has either not been launched or was terminated by the system or the user.
2. Inactive
- The app is in the foreground but not receiving user input.
- Typically, this occurs during transitions, such as when a phone call is received or the app is about to become active.
3. Active
- The app is in the foreground and receiving user input.
- This is the state where most app interactions and updates occur.
4. Background
- The app is running in the background and executing code.
- Apps can perform tasks like fetching data, playing music, or completing a download in this state.
- If the app doesn’t have a background task, it transitions quickly to the Suspended state.
5. Suspended
- The app is in memory but not executing any code.
- This state is managed by the system to preserve battery life and system resources.
- If memory pressure occurs, the system may terminate the app.
Lifecycle Callbacks
The app’s state transitions are handled using the AppDelegate
or the newer SceneDelegate
in multi-scene apps. Key lifecycle methods include: