title: Swift: Override can only be specified on class members
body: <p>In my GameScene.swift file, there are errors that are causing the build to fail.</p>
  
  <pre><code>override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
      /* Called when a touch begins */
  
      for touch: AnyObject in touches {
          let location = touch.locationInNode(self)
  
          let sprite = SKSpriteNode(imageNamed:"Spaceship")
  
          sprite.xScale = 0.5
          sprite.yScale = 0.5
          sprite.position = location
  
          let action = SKAction.rotateByAngle(CGFloat(M_PI), duration:1)
  
          sprite.runAction(SKAction.repeatActionForever(action))
  
          self.addChild(sprite)
      }
  }
  
  override func update(currentTime: CFTimeInterval) {
      /* Called before each frame is rendered */
  }
  </code></pre>
  
  <p>I am told that 'override can only be specified on class members'.</p>
  
  <p>How should I fix this?</p>
  
  <p>This is the whole thing:</p>
  
  <pre><code>//
  //  GameScene.swift
  //  Swipe Racer
  //
  //  Created by William Clark on 25/10/2014.
  //  Copyright (c) 2014 Arc of Clark. All rights reserved.
  //
  
  import SpriteKit
  import Darwin
  
  class GameScene: SKScene {
  
  override func didMoveToView(view: SKView) {
      /* Setup your scene here */
  
      var swipes = SPSwipes()
  
      if swipes.no_of_swipes == 5 {
          var array = Array&lt;UInt32&gt;(count: 5, repeatedValue: 0)
          for i in 0 ..&lt; 5 {
              array[i] = arc4random_uniform(100)}
          }
  
      if swipes.no_of_swipes == 10 {
          var array = Array&lt;UInt32&gt;(count: 10, repeatedValue: 0)
          for i in 0 ..&lt; 10 {
              array[i] = arc4random_uniform(100)}
      }
  
      if swipes.no_of_swipes == 25 {
          var array = Array&lt;UInt32&gt;(count: 25, repeatedValue: 0)
          for i in 0 ..&lt; 25 {
              array[i] = arc4random_uniform(100)}
      }
  
   func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
      /* Called when a touch begins */
  
      for touch: AnyObject in touches {
          let location = touch.locationInNode(self)
  
          let sprite = SKSpriteNode(imageNamed:"Spaceship")
  
          sprite.xScale = 0.5
          sprite.yScale = 0.5
          sprite.position = location
  
          let action = SKAction.rotateByAngle(CGFloat(M_PI), duration:1)
  
          sprite.runAction(SKAction.repeatActionForever(action))
  
          self.addChild(sprite)
      }
  }
  
  func update(currentTime: CFTimeInterval) {
      /* Called before each frame is rendered */
  }
  }
  </code></pre>
  
  <p>There is also a syntax error at the bottom mentioned in the comment section.</p>