Swift + Create Main file in Swift

How to Create Main file in Swift 



Next, File->New->File... to create a Swift file and name it main.swift. Here's how it should look for an iOS app:


import UIKit

UIApplicationMain(
    CommandLine.argc,
    UnsafeMutableRawPointer(CommandLine.unsafeArgv)
        .bindMemory(
            to: UnsafeMutablePointer<Int8>.self,
            capacity: Int(CommandLine.argc)),
    nil,
    NSStringFromClass(AppDelegate.self)

)

NOTE : If we have create custom main.swift file then we don't need to write @UIApplicationMain in appDelegate.swift file


Comments