Well, you picked a rather complicated one. The @
merely means that this is an attribute - a special marker or signal to the compiler, as Apple explains here. But @UIApplicationMain
is a particularly profound attribute! It substitutes for the entire UIApplicationMain
implementation that lies at the heart of a C / Objective-C application, in the main.m file (as I explain here):
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil,
NSStringFromClass([AppDelegate class]));
}
}
That is the main entry point of the app, implementing the entire launch-and-run code that is the running application. You can do something like that in Swift — a main.swift file with the Swift equivalent of that code — but Swift saves you the trouble by letting you designate your app delegate class with the @UIApplicationMain
attribute.
If you start a project as an Objective-C or Objective-C++ project, the template will give you a main file containing the main
implementation, so there's no need to do anything special in this regard.