Lim Thye Chean Lim Thye Chean - 24 days ago 10
Swift Question

How to fix main.swift in Mac Project?

I wanted to update an old Mac project in Swift, and after all the conversion to Swift 3, I was faced with this error:

Use of unresolved identifier 'C_ARGV'
Use of unresolved identifier 'C_ARGC'


And the issue is with this file: main.swift, which consists of only 2 statements:

import Cocoa
NSApplicationMain(C_ARGC, C_ARGV)


How can I fixed this to make my project work again?

Answer

Add @NSApplicationMain on the top of the AppDelegate class (above the class... line) and delete main.swift.