【问题标题】:How to take user input in playground in Swift? [closed]如何在 Swift 的操场上接受用户输入? [关闭]
【发布时间】:2016-12-07 10:48:33
【问题描述】:

我想从命令行获取用户输入。我正在使用readLine(),但我无法提供任何意见。

【问题讨论】:

标签: swift input command command-line-interface swift-playground


【解决方案1】:

在 Playground 中,无法从用户那里获取输入。 Playground 只是您的 swift 代码的启动器。

对不起!

【讨论】:

    【解决方案2】:

    使用 Single View 创建一个 Playground,并添加一个 UITextView 和一个输入按钮。

    【讨论】:

      【解决方案3】:

      如下声明 var a = readLine()

      【讨论】:

      • 这在 Swift Playgrounds 代码中无效。
      猜你喜欢
      • 1970-01-01
      • 2013-09-23
      • 1970-01-01
      • 2016-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-10
      • 1970-01-01
      相关资源
      最近更新 更多