5 Replies
      Latest reply on Aug 22, 2016 5:25 PM by mattn
      mattn Level 1 Level 1 (10 points)

        I don't understand how to write a main.swift file in Swift 3 (current toolchain). We used to write it like this:


            Process.argc, Process.unsafeArgv, nil, NSStringFromClass(AppDelegate)


        But now that won't compile, because there is a type mismatch between Process.argv, which is typed like this:




        and the second parameter to UIApplicationMain, which is typed like this:




        As you can see, they are subtly different. I am able to work around the problem by writing this:


        withUnsafeMutablePointer(&Process.unsafeArgv.pointee!) {
                Process.argc, $0, nil, NSStringFromClass(AppDelegate)


        But whether that is safe or correct, I have no idea.