Swift 如何使用NSImage在Xcode游乐场中显示图像
当我点击侧栏中的眼睛时,我实际上可以预览我的图像。但是,代码的最后一行没有显示任何内容Swift 如何使用NSImage在Xcode游乐场中显示图像,swift,xcode,Swift,Xcode,当我点击侧栏中的眼睛时,我实际上可以预览我的图像。但是,代码的最后一行没有显示任何内容 //: A Cocoa based Playground to present user interface import AppKit import PlaygroundSupport let nibFile = NSNib.Name("MyView") var topLevelObjects : NSArray? let imgView = NSImageView(frame:NSRect(x:
//: A Cocoa based Playground to present user interface
import AppKit
import PlaygroundSupport
let nibFile = NSNib.Name("MyView")
var topLevelObjects : NSArray?
let imgView = NSImageView(frame:NSRect(x: 0, y:0 , width: 300, height: 400))
imgView.image = NSImage(byReferencingFile: "/Users/me/Code/MyPlayground.playground/Resources/image.png")
PlaygroundPage.current.liveView = imgView