Uplift iOS Interview
"Uplift iOS Interview" is a comprehensive guide to help aspiring iOS developers soar to new heights in their careers. This book is an indispensable tool for anyone looking to crack the iOS interview and impress their future employers with their technical prowess. With in-depth coverage of Swift, AutoLayout, SwiftUI, Multithreading, Memory management so on and so forth, this book is a treasure trove of knowledge for anyone looking to uplift their iOS development career.
iOS app development is a constantly evolving field, with each new release of the operating system introducing new features and capabilities. One of the most significant changes in recent years has been the move towards a scene-based life cycle model for iOS apps. This new model, which was introduced in iOS 13, has important implications for developers, particularly those who are building complex, multi-window apps.
In this blog post, we will explore the iOS app life cycle in depth, focusing specifically on the scene-based model introduced in iOS 13+ and clear up some confusions at the end.
What is the iOS App Life Cycle?
The iOS app life cycle refers to the set of events that occur from the moment a user launches an app to the moment they close it. These events include things like app launch, backgrounding, foregrounding, and termination.
Prior to iOS 13, the app life cycle was based on a single window. This meant that when a user opened an app, they were presented with a single window that contained all of the app’s functionality. When the app was backgrounded or terminated, the entire app was suspended or closed.
What is the Scene-Based Life Cycle Model?
With the introduction of iOS 13, Apple introduced a new scene-based life cycle model. This model is designed to support multi-window apps and provide more flexibility for users.
Under the scene-based life cycle model, an app can contain multiple scenes, each of which is associated with a separate window. This means that when a user opens an app, they can choose to open one or more scenes, each of which contains a different subset of the app’s functionality.
When a scene is backgrounded or terminated, only that specific scene is suspended or closed. This means that the user can continue to use other scenes within the app, even if one of them is no longer in use.
How do Scene-based Life-cycle Events Propagate?
If your app has different parts called “scenes,” each scene can do its own thing at different times. A scene is like a separate screen that you can open, close, or switch between. You can have more than one scene for the same app, and you can choose to show or hide them. Since each scene has its own way of working, it can be in a different state. For example, one scene might be on the screen while the others are in the background or paused. When you or the device asks for a new scene, the app creates it and puts it in a state where it’s not connected to anything(Unattached state). When you open a scene that you asked for, it quickly comes to the front and appears on the screen(Foreground Active). But if the device needs to do something important, like receiving a call, the app goes to inactive state(Foreground Inactive). However, app might do some calculation in the background(Background state). When you close the app(Suspended state), the scene might get closed to save space.

What are Scene-based Life-Cycle Events?
The scene-based life cycle model introduces a new set of events that occur during the life cycle of an iOS app. These events are specific to each scene and are designed to provide more granular control over how the app behaves.
The scene-based life-cycle events include:
- Scene Will Connect to Session: This event occurs when a new scene is created and is about to connect to the app’s session. At this point, the app can perform any setup or initialization tasks that are specific to the new scene.
- Scene Did Disconnect: This event occurs when a scene is removed from the app’s session. At this point, the app can perform any cleanup or teardown tasks that are specific to the removed scene.
- Scene Will Enter Foreground: This event occurs when a scene is about to enter the foreground. At this point, the app can perform any tasks that are specific to the foregrounding of the scene, such as updating the UI or starting a new task.
- Scene Did Enter Foreground: This event occurs when a scene has entered the foreground. At this point, the app can perform any tasks that are specific to the foregrounded scene, such as displaying a notification or starting a new activity.
- Scene Will Resign Active: This event occurs when a scene is about to resign its active status. At this point, the app can perform any tasks that are specific to the deactivation of the scene, such as stopping an animation or pausing a video.
- Scene Did Become Active: This event occurs when a scene has become active. At this point, the app can perform any tasks that are specific to the activation of the scene, such as starting an animation or resuming a video.
- Scene Will Enter Background: This event occurs when a scene is about to enter the background. At this point, the app can perform any tasks that are specific to the backgrounding of the scene, such as saving user data or stopping
How much time app can run in the background?
According to apple, only specific app types are allowed to run in the background:
- Apps that play audible content to the user while in the background, such as a music player app
- Apps that keep users informed of their location at all times, such as a navigation app
- Apps that support Voice over Internet Protocol (VoIP)
- Newsstand apps that need to download and process new content
- Apps that receive regular updates from external accessories
Other than the specific things an app can do in the background, there is also a way for an app to continue working for a very brief time, which is explained in the “Executing a Finite-Length Task in the Background” section of the documentation. After that short time, the app can either let the system know it’s finished and then be suspended, or the system can forcefully shut it down.
What is the difference between background and suspended state in iOS?
The iOS system has two states for apps when they are not currently being used by the user: background and suspended.
When an app is in the background state, it can still execute code and perform tasks. For example, if you upload a short on Youtube and switch to another app, YouTube can still complete the upload in the background. However, being in the background state doesn’t necessarily mean the app is suspended. An app can ask to stay in the background for a short period of time to complete tasks like uploading a video or finishing a network request. After that, the app will either go into a suspended state or be forced to close by the system.
When an app is in the suspended state, it is not executing any code and is just stored in memory. This state is also considered to be in the background. The system moves apps to the suspended state without notifying the user beforehand.
Read more from Apple documentation.
Rev Up Your iOS Skills: Take a Dynamic Learning Journey

iOS Career Boost is the ultimate learning journey to elevate your iOS development career through a dynamic blend of visual learning, handy cheat sheets, coding practice materials, and expertly curated tips and tricks
Get Ready to Shine: Mastering the iOS Interview
- Uplift iOS Interview - A Comprehensive Guide to iOS Interview
- Xcode Cheat Sheet for Swift
- Xcode Cheat Sheet for SwiftUI
Enjoying the articles? Get the inside scoop by subscribing to my newsletter.
Get access to exclusive iOS development tips, tricks, and insights when you subscribe to my newsletter. You'll also receive links to new articles, app development ideas, and an interview preparation mini book. Your email address will only be used for the purpose of sending the newsletter and will not be shared with third parties or advertisers. Rest assured that we value your privacy and will not spam your inbox.
Connect with me on
Twitter and LinkedIn and don't hesitate to reach out with any questions about this post. Thank you for reading.