2017-04-11 53 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