title: Terrible flicker when using SKView in NSScrollView
body: <p>Unfortunately using <a href="https://developer.apple.com/library/mac/documentation/SpriteKit/Reference/SKView/index.html#//apple_ref/doc/uid/TP40013031" rel="nofollow noreferrer">SKView</a> in a <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSScrollView_Class/index.html" rel="nofollow noreferrer">NSScrollView</a> seems utterly unusable.</p>
  
  <p><a href="https://github.com/danieljfarrell/TerribleFlickerWithSKViewInNSScrollView/" rel="nofollow noreferrer">Project available on github.</a></p>
  
  <p>Does anybody have any clever workarounds or am I doing something very stupid?</p>
  
  <ul>
  <li>Terrible flicker when scrolling</li>
  <li>Terrible flicker when resizing the window</li>
  <li>The shape is a circle, however, the aspect ratio is getting all messed up.</li>
  </ul>
  
  <p>I'm running this on a MacBook Pro (Retina, Mid 2012), OS X 10.10.2; could be device specific.</p>
  
  <p><img src="https://i.stack.imgur.com/nXN1i.gif" alt="Terrible flicker"></p>
  
  <p>Here is the code, everything is setup in AppDelegate,</p>
  
  <pre><code>class AppDelegate: NSObject, NSApplicationDelegate {
  
      @IBOutlet weak var window: NSWindow!
  
      @IBOutlet weak var spriteKitView: SKView!
  
      @IBOutlet weak var scrollView: NSScrollView!
  
      var scene : SKScene?
      var rootNode : SKNode?
      var shape : SKShapeNode?
      var sprite : SKSpriteNode?
  
      func applicationDidFinishLaunching(aNotification: NSNotification) {
          // Insert code here to initialize your application
  
          let side = 500.0
          scene = SKScene(size: CGSize(width: side, height:side))
          scene?.backgroundColor = NSColor.whiteColor()
          spriteKitView.presentScene(scene)
          spriteKitView.setFrameSize(CGSize(width: side, height: side))
          scrollView.scrollPoint(CGPoint(x: CGFloat(side/2), y: CGFloat(side/2)))
  
          // Add root node
          rootNode = SKNode()
          scene!.addChild(rootNode!)
  
          // Add shape to root node
          shape = SKShapeNode(circleOfRadius: CGFloat(side/10))
          shape!.fillColor = NSColor.redColor()
          shape!.lineWidth = 1.0
          shape!.position = CGPoint(x: CGFloat(side/2), y: CGFloat(side/2))
          rootNode!.addChild(shape!)
  
          //
          sprite = SKSpriteNode(imageNamed: "image")
          rootNode!.addChild(sprite!)
  
      }
  
      func applicationWillTerminate(aNotification: NSNotification) {
          // Insert code here to tear down your application
      }
  }
  </code></pre>