title: macOS - Programmatically display an image using NSImageView
body: <p>Using a Swift app targeting the macOS platform, I am trying to programmatically create an NSImageView object, assign an image to it, and then display it, using:</p>
  
  <pre><code>let imageViewObject = NSImageView();
  let img = NSImage(cgImage: winCGImage, size: NSZeroSize);
  imageViewObject.image = img
  self.window.contentView?.addSubview(imageViewObject)
  </code></pre>
  
  <p>However, no image is displayed when I run this.
  On the debugger, I can see that <code>imageViewObject.image</code> (i.e. <code>img</code>) has a valid image, and I can view it using the eye icon.</p>
  
  <p>What am I missing?</p>