Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 22.214.171.124 release ready!
This blog is completely about how UIApplicationMain Function contributes to the iOS app launch process.
In swift, there is no main function but it has an attribute @UIApplicationMain. You can see this in the AppDelegate class.
It creates an entry point to the Application that calls UIApplicationMain to start the Application.
Calling this function is the primary thing the app does. The entire iOS application is nothing but a gigantic call to UIApplicationMain.
It create your app’s shared application instance.
UIApplication is responsible for handling & routing user events. Every iOS Application has only one instance of UIApplication.
UIApplication is accessible in code using UIApplication.shared. If you pass nil in this then it will take UIApplication by default.
It also creates the applications’ instance delegate.
The declaration of UIApplicationDelegate in the UIApplication class looks as follows. You will be able to access it as UIApplication.shared.delegate.
If the app has main.storyboard, UIApplicationMain creates an app window. It’s basically an instance of UIWindow. And assigns this window as the AppDelegate’s window property and assigns the initial view controller as rootViewController.
UIApplicationMain now turns to the app delegate and starts calling some of its code, such as application(_:didFinishLaunchingWithOptions:). It is a good place to add some startup code, but don’t add any heavy work here.
It now cause your app’s interface to appear.
Once the above method is called, the window is about to appear, now it will ask the root view controller to get its main view.
The app can be developed without the main storyboard.
Let’s see the code in didFinishLaunchingWithOptions
I hope this blog helps you to understand the functionality of UIApplicationMain in swift.
Thanks for Reading !!
For more blogs click here
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.
Founder, Das Apartment Living
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.