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.