UIApplicationMain function, will be automatically called in main.m source file. The UIApplicationMain function creates an application object that sets up the infrastructure for your iOS app to work with the iOS system. This includes creating a run loop that delivers input events to your app.
The call to UIApplicationMain creates two important initial components of your app:
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([XYZAppDelegate class]));
}
- An instance of the UIApplication class, called the application object. The application object manages the app event loop and coordinates other high-level app behaviors. This class, defined in the UIKit framework, doesn’t require you to write any additional code to get it to do its job.
- An instance of the XYZAppDelegate class, called the app delegate. Xcode created this class for you as part of setting up the Empty Application template. The app delegate creates the window where your app’s content is drawn and provides a place to respond to state transitions within the app. This window is where you write your custom app-level code. Like all classes, the XYZAppDelegate class is defined in two source code files in your app: in the interface file, XYZAppDelegate.h, and in the implementation file, XYZAppDelegate.m.