title: Spawn enemies randomly only within the screen width
body: <p>I started working with SKS files to create games in swift, and in this game im trying to get enemies to spawn randomly within the width of the phone screen as opposed to all over the sks file scene</p>
  
  <pre><code>override func didMoveToView(view: SKView) {
     self.physicsWorld.contactDelegate = self
      NSTimer.scheduledTimerWithTimeInterval(0.2, target: self, selector: Selector("spawnEnemy"), userInfo: nil, repeats: true)
  }
  
  func spawnEnemy(){
     //supposed to pick random point within the screen width
      let xPos = Int.random(self.frame.width)
  
      enemy = SKSpriteNode(imageNamed: "enemy")
      enemy.position = CGPointMake(CGFloat(xpos), self.frame.size.height/2)
      enemy.physicsBody = SKPhysicsBody(circleOfRadius: 7)
      enemy.physicsBody?.affectedByGravity = true
      enemy.physicsBody?.categoryBitMask = 0
      enemy.physicsBody?.contactTestBitMask = 1
      addChild(self.enemy)
  }
  </code></pre>