ios - 无法使用 swift playground 在助理编辑器中查看控制台输出

标签 ios swift swift-playground

任何人都可以解释一下,为什么控制台输出在助理编辑器中不可见。右侧栏仅显示“Hello, Playground”,助理编辑器显示空白。

//Playground - 名词:人们可以玩耍的地方

   import UIKit

   var str = "Hello, playground"

   println("Hello")

   NSLog("Hello, world")

最佳答案

您需要导入 cocoa 库:

import Cocoa

这个示例对我来说工作正常:

import Cocoa

var str = "Hello, playground"
println("Hello")

NSLog("Hello, world")

关于ios - 无法使用 swift playground 在助理编辑器中查看控制台输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24465638/

相关文章:

ios - 如何在 TableView 中将图像添加到行操作?

objective-c - 键盘不会用 UITextField 关闭

swift - 为 UIControl 子类设置 selectedTitleTextAttributes

swift - NSDictionary:错误在展开可选值时意外发现 nil

ios - swift 3 : Filtering IOS notifications

ios - 调试错误 xcode 6- 使用 google maps sdk

swift - 传递具有相同名称的函数会出现 "ambiguous"错误

swift - CollectionViewCell 发送上一张图像

swift - Playground 中的 UIView

swift - NS无效参数异常 : A Node can't parent itself