title: Repeating an action forever with a global function
body: <p>I have a rectangle that needs to be constantly moving up, but is also declared globally like so so that I can call it in multiple places:</p>
  
  <pre><code>   var obstacle = SKNode!
  
    override func didMoveToView {
       obstacle = rectangle()
      }
  
  
    func rectangle() -&gt; SKNode {
     let rect = SKSpriteNode(imageNamed: "Rectangle@x2")
      rect.size = CGSizeMake(30, 30)
  
      rect.position = CGPointMake(210, -250)
      rect.physicsBody?.categoryBitMask = PhysicsCatagory.littleRect
     rect.physicsBody?.contactTestBitMask = PhysicsCatagory.bigRect
      rect.physicsBody?.collisionBitMask = 0
     rect.physicsBody = SKPhysicsBody(rectangleOfSize: rect.size)
      rect.physicsBody?.dynamic = true
      rect.physicsBody?.affectedByGravity = false
      rect.runAction(
          SKAction.moveByX(0, y: 1200,
              duration: NSTimeInterval(6.5)))
  
      addChild(rect)
      return rect
  
  }
  When I attempt to run it as an action repeating forever like so, i get the error "cannot convert value of type SKNode to argument runBlock" : 
  
     runAction(SKAction.repeatActionForever(
          SKAction.sequence([
              SKAction.runBlock(rectangle),
              SKAction.waitForDuration(4.0)])))
  </code></pre>
  
  <p>So is there a way to declare this sort of action for a function set up like this? Thank you in advance. </p>