简体   繁体   English

Swift入口点

[英]Swift Entry Point

I am very new to Swift, Just one line: 我对Swift很新,只有一行:

Code written at global scope is used as the entry point for the program, so you don't need a main() function. 在全局范围编写的代码用作程序的入口点,因此您不需要main()函数。 You also don't need to write semicolons at the end of every statement. 您也不需要在每个语句的末尾写分号。

at Official Swift Tour Page . 斯威夫特官方旅游页面

I have gone through What is the entry point of swift code execution? 我已经完成了快速代码执行的切入点是什么?

I really don't understand how main.m is merged with AppDelegate.swift, Can somebody explain it in a simple way. 我真的不明白main.m是如何与AppDelegate.swift合并的,有人可以用一种简单的方式解释它。 Thanks! 谢谢!

There is no change in main.m. main.m没有变化。 In swift, if you still want to do any task before AppDelegate excution\\call you can create file again. 在swift中,如果您仍想在AppDelegate执行\\调用之前执行任何任务,则可以再次创建文件。

Please refer below link 请参考以下链接

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

Hope it will helpful. 希望它会有所帮助。

Edit: as per my understanding In swift, main.m is literally not required so, Apple merge it in AppDelegate. 编辑:根据我的理解在swift中,main.m实际上并不是必需的,Apple将它合并到AppDelegate中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM