When you create a swift project, you find that the project structure is concise, there is no. pch file, and there is a. main file,
Naturally will not find the main function of the entrance, an instant on the app's startup process is not a clue, open appdelegate.swift
At the beginning, I found @UIApplicationMain familiar name, and the first thought was in the OBJC project.
int main (int argc, char * argv[]) { @autoreleasepool { return Uiapplicationmain (argc, argv, Nil, Nsstringfromclass ([Senappdelegate class]);} }
As a matter of course, it is believed that a symbol and a word in swift are equal to a main.m file, so efficient!!!
I really do not want a bit of redundant code AH This is, worship Ah, Swift's efficiency is evident.
First look at the official details of the little Apple
Then we looked at Swift's declaration, and the OBJC changed quite a lot, compared with the two attribute declarations in uiapplication.
1.0@property (nonatomic,readonly) UIWindow *keywindow; @property (nonatomic,readonly) Nsarray
Vs
1.0 var Keywindow:uiwindow? {Get}
The contrast is self-evident ~ ~
Same as the official said, you can add your own main.swift specifies the delegate name of the response, the code is as follows:
Import Foundationimport Uikituiapplicationmain (C_ARGC, C_ARGV, Nsstringfromclass (uiapplication), NSStringFromClass ( Appdelegate))
Careful research, swift writing projects in addition to grammatical, and other aspects of the changes are quite large ...
Finally, just to say that the programmer is happy, the code efficiency is high ...
Learn from the beginning ...
[IOS] @UIApplicationMain