How do I access program arguments in Swift?

后端 未结 5 791
别跟我提以往
别跟我提以往 2020-12-01 03:11

C and derivatives have argc and argv (and envp) parameters to their entry point functions, but Swift doesn\'t have one proper: top-lev

5条回答
  •  無奈伤痛
    2020-12-01 03:41

    Process was just renamed into CommandLine (since Swift 3.0 August 4 snapshot)

    let arguments = CommandLine.arguments
    

    (for some reason this wasn't mentioned on the changelog)

提交回复
热议问题