我一直在关注苹果指南的新语言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)

我似乎无法找到如何println()在Swift 2中做.
我试过了 println(helloworld)
这不起作用
helloworld是一个变量
我正在使用蓝牙从传感器获取数据,我想将获得的数据字符串附加到文件末尾。
当我尝试常规方法时
if let dir = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.AllDomainsMask, true).first {
let path = NSURL(fileURLWithPath: dir).URLByAppendingPathComponent(self.file)
do {
try text.writeToURL(path, atomically: false, encoding: NSUTF8StringEncoding)
}
catch {/* error handling here */}
Run Code Online (Sandbox Code Playgroud)
我的应用程序开始变慢,直到标签不再更新。
尝试dispatch_async在后台线程中使用,但它仍然减慢了我的应用程序的速度。
我应该使用什么方法?我阅读了有关流的内容,但未能迅速找到一些我可以依赖的解决方案
在同一行打印字符
for i in 1...5
{
print(i)
}
Run Code Online (Sandbox Code Playgroud)
操作需要像
12345
Run Code Online (Sandbox Code Playgroud)
但是印刷品就像
1
2
3
4
5
Run Code Online (Sandbox Code Playgroud)
任何人都有解决方案.