2017-04-11 73 views
1

我是很新的雨燕,只有一行:在全局范围内书面斯威夫特入口点

代码作为切入点程序,所以你并不需要一个main()函数。您也不需要在每个语句的末尾都写分号。

在官方Swift Tour Page

我已经通过What is the entry point of swift code execution?

走后,我真不明白的main.m是如何合并AppDelegate.swift,有人能以简单的方式解释。谢谢!

+1

在AppDeligate中有一个[@UIApplicationMain](http://stackoverflow.com/questions/24105690/what-is-the-entry-point-of-swift-code-execution),它是入口点。 – user3440589

+0

确定了它UIApplicationMain下,它被定义: 公共FUNC UIApplicationMain(_的argc:的Int32,_的argv:UnsafeMutablePointer >!_ principalClassName:字符串?, _ delegateClassName:字串) - >的Int32 – Ren

回答

3

main.m.没有变化。快速地,如果你仍然想在AppDelegate excution \ call之前完成任何任务,你可以重新创建文件。

请参考以下链接

https://richardallen.me/2015/05/16/main-swift.html

希望它会很有帮助。

编辑: 按我的理解 在迅速,main.m文件字面上并不需要如此,苹果将其合并在AppDelegate中。

+0

确定GOT它在UIApplicationMain下定义为: public func UIApplicationMain(_ argc:Int32,_ argv:UnsafeMutablePointer >!,_ principalClassName:String?,_ delegateClassName:String?) - > Int32 – Ren