Swift 入口点

Swift Entry Point

我对Swift很陌生,只有一行:

Code written at global scope is used as the entry point for the program, so you don’t need a main() function. You also don’t need to write semicolons at the end of every statement.

官方 Swift Tour Page.

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

我真的不明白main.m和AppDelegate.swift是怎么合并的,谁能简单的解释一下。谢谢!

main.m没有变化。在 swift 中,如果您仍想在 AppDelegate excution\call 之前执行任何任务,您可以重新创建文件。

请参考下文link

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

希望对您有所帮助。

编辑: 据我了解 在 swift 中,main.m 确实不是必需的,Apple 将其合并到 AppDelegate 中。