Please help with this LLDB

Hi,


I'm just starting to learn Swift and in the Playground area, I have come to a little problem.


This is my code:

/
import UIKit
var str = "Hello, playground"
class Person {

    init (){
        println("A new person has been created")
    }

    func sayCheese(){
        println("Cheese!")
    }

}
var b = Person()
b.sayCheese()


At line 17. adn 16. it says "__lldb_expr_54.Person" - I'm not really sure what this means but to my prior coding knowledge, there shoudl't be anything wrong? Unless C is very different to Java.


Would really help if you could explain what is wrong and why its wrong!


Thanks

What do you mean by "it says"? Is it a compiler error or warning or is it console output?


Oh, and Swift is not part of the C/Java family. While it shares many features with older languages, it was recently built from the ground up and includes several unique features not found anywhere else.

You haven't really shared which version of Xcode you are using so you may want to just edit the original question. Knowing the version will also indicate to us which version of Swift you are using. Your code implies that it is either Swift 1 or 1.2. When I paste the code into the latest beta version of Xcode (7.0 beta 5 - build 7A176X), it does not show any errors. In Swift 2.0 the println has been changed to print. Looking at the right side output I can see the expected output (basically the two print statements show their messages on lines 14 and 15).


import UIKit
var str = "Hello, playground"
class Person {
  
    init (){
        print("A new person has been created")
    }
  
    func sayCheese(){
        print("Cheese!")
    }
  
}
var b = Person()
b.sayCheese()


When I open the debug utility in this version of Xcode, I see the following message. (Note that my file name is DeveloperHelp):

Aug 21 01:58:07  DeveloperHelp[9906] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Aug 21 01:58:07  DeveloperHelp[9906] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Aug 21 01:58:07  DeveloperHelp[9906] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
A new person has been created
Cheese!


So, you may be using a version of Xcode that needs to be upgraded. In any case I would not consider that your code is broken. It looks okay, except for the slash ( / ) on line 01. Please let me know if this answers your question.

Please help with this LLDB
 
 
Q