Swift Playground中的空类给出了__lldb_expr_错误 [英] Empty Class in Swift Playground Gives __lldb_expr_ Error
问题描述
在Swift Playground中敲出一个空类会出错 __ lldb_expr _
Knocking up an empty class within a Swift Playground gives an error __lldb_expr_
//: Playground - noun: a place where people can play
import UIKit
class FooBar {
}
let foo = FooBar()
参见附页截图。
See attached screenshot.
这发生在Xcode版本 6.3.1(6D1002)上。我也尝试过最新的Xcode 6.4 beta 3 - 版本6.4(6E7) - 2015年5月11日发布。出现同样的错误。
This occurs on Xcode Version 6.3.1 (6D1002). I have also tried with the latest Xcode 6.4 beta 3 - Version 6.4 (6E7) - available 11th May 2015. The same error occurs.
在正常的Swift项目中,空类构建没有问题。
Empty classes build without issue in a normal Swift project.
只需添加一个虚拟常量就可以避免错误,如下所示:
The error can be avoided by simply adding a dummy constant as follows:
//: Playground - noun: a place where people can play
import UIKit
class FooBar {
let wibble = 10
}
let foo = FooBar()
对于这个错误感到惊讶,因为创建一个初始的空类是如此基本的事情。在我的情况下,我想要一个滚动视图委托类来跟踪内容偏移。使用没有属性的委托似乎是完全合理的。
Was surprised at this error given that creating a initial empty class is such a basic thing. In my case I wanted a scroll view delegate class to track content offsets. It would seem entirely reasonable to use a delegate with no properties.
任何想法?
推荐答案
这不是错误。
这是一个信息,变量 foo
现在拥有类 FooBar $的对象c $ c>其内部名称是
__ lldb_expr_12.FooBar
。在这种情况下, __ lldb_expr_12
是Playground中Swift模块的名称。
It's an information that the variable foo
now holds an object of class FooBar
whose internal name is __lldb_expr_12.FooBar
. __lldb_expr_12
is the Swift module's name in the Playground in this case.
这篇关于Swift Playground中的空类给出了__lldb_expr_错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!