Search code examples
swiftios8xcode6swift-playground

Empty Class in Swift Playground Gives __lldb_expr_ Error


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. __lldb_expr_4 at line 12 on attempted instantiation of class FooBar

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?


Solution

  • 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.