Search code examples
swiftcommand-line-tool

How to get the launch arguments while making a command line tool with swift


I make a command line tool in xcode5.1.1 with c.But now I want to make one in xcode6 with swift. I was struck by the new command line tool project with swift!I know there is no main() function in swift,but I can't find any way to get the launch arguments.

Is there any way to get them?


Solution

  • See the linked question, there’s the answer How do I access program arguments in Swift?

    import Foundation
    
    let args = NSProcessInfo.processInfo().arguments;
    println(args);