Skip to content

Instantly share code, notes, and snippets.

@tomburns
Created June 3, 2014 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomburns/8975715cd4811d30417f to your computer and use it in GitHub Desktop.
Save tomburns/8975715cd4811d30417f to your computer and use it in GitHub Desktop.
import Cocoa
class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override var representedObject: AnyObject? {
didSet {
// Update the view, if already loaded.
}
}
@IBOutlet var imagePathControl : NSPathControl
@IBOutlet var imageView : NSImageView
@IBAction func updateImage(sender :AnyObject) {
let imageURL = self.imagePathControl?.URL
let image = NSImage(byReferencingURL: imageURL)
if image.valid {
self.imageView.image = image
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment