Gal*_*her 4 xcode read-eval-print-loop swift-playground
我注意到Xcode 10中的Playgrounds不再允许使用已声明但未初始化的变量.例如:虽然这段代码可以在Xcode 9游乐场中运行,但在Xcode 10游乐场(至少在Beta 1中),它会崩溃:
var myValue: Int
//...
myValue = 100
print (myValue)
// Xcode 9 prints 100
// Xcode 10 reports an error: variables currently must have an initial value when entered at the top level of the REPL
Run Code Online (Sandbox Code Playgroud)
这是新行为,还是当前Xcode 10 beta中的一个错误?
我曾经将早期的Xcode Playgrounds称为翻译,但是仍然会考虑将Xcode 10游乐场作为翻译(并且总是正确的)?Apple将装订线中的"运行"按钮称为"编译"代码.
谢谢!
小智 8
我遇到了这个错误.我有两个不同的操场,一个有错误,一个没有.问题是我的游乐场没有设置"自动运行".要设置该选项,请单击操场中调试窗口顶部的播放箭头,您将看到"自动运行"选项,选择它.
必须是自动运行模式更像是运行整个程序,而手动运行则不是.
| 归档时间: |
|
| 查看次数: |
2284 次 |
| 最近记录: |