Empty Class in Swift Playground Gives __lldb_expr_ Error

梦想与她 提交于 2019-12-01 22:15:52

问题


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.

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.

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.

Any ideas?


回答1:


This is not an error.

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.



来源:https://stackoverflow.com/questions/30303410/empty-class-in-swift-playground-gives-lldb-expr-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!