title: Lag when trying to implement parallax effect in swift (spritekit)
body: <p>I am trying to create game in SpriteKit with parallax effect, but when I implement my method, my hero lags (quickly shakes) from time to time (no pattern observed)...</p>
  
  <p>I wrote this simple code that illustrates the method and also contains the same problem. </p>
  
  <p>The hero should stay in the center of the screen and only his position relative to his parent (foreground) should change. But it lags (quickly shakes for a really short moment) every now and then. I also noticed that when I run the game, the hero sinks down very, very slowly a few pixels (maybe 5-10) before it starts holding its position after ~15 sec.</p>
  
  <p>I can't figure out what is causing this behavior. Any help would be appreciated. I am testing on IPhone 6.</p>
  
  <pre><code>import SpriteKit
  
  class GameScene: SKScene, SKPhysicsContactDelegate {
  
  
  let hero = SKSpriteNode(imageNamed: "hero")
  let foreground = SKNode()
  
  
  required init?(coder aDecoder: NSCoder) {
      super.init(coder: aDecoder)
  }
  
  override init(size: CGSize) {
      super.init(size: size)
  
  
      physicsWorld.gravity = CGVector(dx: 0.0, dy: -0.5)
      physicsWorld.contactDelegate = self
  
  
      // anchor point of scene is at (x: 0.5, y: 0.5)
  
      hero.position = CGPoint(x: 0, y: 0)
      hero.physicsBody = SKPhysicsBody(rectangleOfSize: hero.size)
      hero.physicsBody?.dynamic = true
      hero.physicsBody?.allowsRotation = false
  
  
      addChild(foreground)
      foreground.addChild(hero)
  }
  
  
  override func update(currentTime: NSTimeInterval) {
  
      foreground.position = CGPoint(x: 0, y: -(hero.position.y))
  }
  }
  
  // I need the foreground to move in opposite direction so I can add stars,
  // monsters, etc while keeping the player in the view... Update method does 
  // this: hero is pulled down by gravity so his y position would be -1 pixel 
  // relative to foreground but I assign foreground the opposite y-position of
  // hero (+1) and since hero's position relative to foreground is -1, he should 
  // be positioned at y-position = 0 which, in this code example, should create 
  // an illusion that he is positioned at the center and doesn't move
  </code></pre>