2

I am very new to Swift, Just one line:

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.

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. Thanks!

NSNoob
  • 5,548
  • 6
  • 41
  • 54
Renuka Pandey
  • 1,730
  • 2
  • 15
  • 27
  • 1
    There is a [@UIApplicationMain](http://stackoverflow.com/questions/24105690/what-is-the-entry-point-of-swift-code-execution) in the AppDeligate which is the entry point. – miltan Apr 11 '17 at 08:45
  • ok got it under UIApplicationMain, it is defined: public func UIApplicationMain(_ argc: Int32, _ argv: UnsafeMutablePointer>!, _ principalClassName: String?, _ delegateClassName: String?) -> Int32 – Renuka Pandey Apr 11 '17 at 09:34

1 Answers1

3

There is no change in main.m. In swift, if you still want to do any task before AppDelegate excution\call you can create file again.

Please refer below link

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.

Darshit Shah
  • 2,366
  • 26
  • 33
  • ok got it under UIApplicationMain, it is defined: public func UIApplicationMain(_ argc: Int32, _ argv: UnsafeMutablePointer>!, _ principalClassName: String?, _ delegateClassName: String?) -> Int32 – Renuka Pandey Apr 11 '17 at 09:34