我一直在关注苹果指南的新语言swift,但我不明白为什么右边的栏只显示"Hello,playground"而不是"Hello,world".有人可以解释为什么println没有在右边打印?
// Playground - noun: a place where people can play
import Cocoa
var str = "Hello, playground"
println("Hello, world");
Run Code Online (Sandbox Code Playgroud)

在搜索了许多(很多!)快速游乐场问题甚至制作这些代码后,我仍然在苦苦挣扎.
我已经将一个文本文件放在Resources包内容的文件夹中,它在playground(/var/folders/ ...)生成的运行临时文件中显示为别名(链接).
import UIKit
let bundle = NSBundle.mainBundle()
let myFilePath = bundle.pathForResource("dict1", ofType: "txt")
println(myFilePath) // <-- this is correct, there is a shortcut to the Resource file at this location
var error:NSError?
var content = String(contentsOfFile:myFilePath!, encoding:NSUTF8StringEncoding, error: &error)
println(content!) // <-- this is *NOT* the file contents [EDIT: see later note]
// Demonstrate there's no error
if let theError = error {
print("\(theError.localizedDescription)")
} else {
print("No error")
}
Run Code Online (Sandbox Code Playgroud)
问题是,content …