标签: swift xcode7-beta3 xcplayground
我在Xcode 7.1(测试版3)中使用Playgrounds,但在使用captureValue()功能时出现问题:
captureValue()
captureValue:withIdentifier:捕获要显示的值 时间线中指定的标识符。 声明 public func captureValue(value:T,withIdentifier identifier: 字符串)
captureValue:withIdentifier:捕获要显示的值 时间线中指定的标识符。
声明
public func captureValue(value:T,withIdentifier identifier: 字符串)
— Apple Developer Site
当我调用该函数时,我得到的只是:
如何使用captureValue?或者这是beta 3中的错误?
答案 0 :(得分:5)
captureValue()显示您在时间轴中捕获的值,这是一个单独的视图,显示在游乐场的助理编辑器中。 (您可以通过按Command-Option-Return来显示助理编辑器。)您显示的是当前行的结果,由于captureValue()返回Void,因此只是{ {1}}本身。
Void
以下是时间轴的样子:
答案 1 :(得分:4)
但是,如果你想在游乐场而不是转储列表中创建一个漂亮的情节,你需要在一个循环中分配var copyText = document.execCommand('copy'); 。
var copyText = document.execCommand('copy');
CaptureValue
Xcode 7.2