A Short Note – In Which Order Custom Code Executes At Launch Time In iOS ?

Hello Readers, CoolMonkTechie heartily welcomes you in A Short Note Series.

In this note series, we will learn about the App Launch Sequence in iOS. We will discuss the order that our custom code executes at launch time in iOS.

In Which Order Custom Code Executes At Launch Time In iOS ?

So Let’s begin.


Overview

Launching an app involves a complex sequence of steps, most of which UIKit handles automatically. During the launch sequence, UIKit calls methods of our app delegate so that we can perform custom tasks. 

The App Launch And Initialization Sequence
The App Launch And Initialization Sequence

In Figure  illustrates the sequence of below steps that occur from the time the app is launched until it is considered initialized.

  1. The app is launched, either explicitly by the user or implicitly by the system.
  2. The Xcode-provided main function calls UIKit’s UIApplicationMain(_:_:_:_:) function.
  3. The UIApplicationMain(_:_:_:_:) function creates the UIApplication object and our app delegate.
  4. UIKit loads our app’s default interface from the main storyboard or nib file.
  5. UIKit calls our app delegate’s application(_:willFinishLaunchingWithOptions:) method.
  6. UIKit performs state restoration, which calls additional methods of our app delegate and view controllers.
  7. UIKit calls our app delegate’s application(_:didFinishLaunchingWithOptions:) method .

When initialization is complete, the system uses either our scene delegates or app delegate to display our UI and manage the life cycle for our app.


Conclusion

In this note series, We understood about the App Launch Sequence in iOS. We discussed the order that our custom code executes at launch time in iOS.

Thanks for reading ! I hope you enjoyed and learned about App Launch Sequence concepts in iOS. Reading is one thing, but the only way to master it is to do it yourself.

Please follow and subscribe us on this blog and and support us in any way possible. Also like and share the article with others for spread valuable knowledge.

If you have any comments, questions, or think I missed something, feel free to leave them below in the comment box.

Thanks again Reading. HAPPY READING !!😊😊😊

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s