Lim Thye Chean Lim Thye Chean - 5 months ago 37
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?


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