title: Create Button in SpriteKit: Swift
body: <p>I want to create a button in <code>SpriteKit</code> or in an <code>SKScene</code> that sends the view to another view controller.</p>
  
  <p>I tried using the "performSegue with identifier ", however apparently an <code>SKScene</code> doesn't support this. 
  How would I create a button that sends the view to another view with <code>SpriteKit</code>?</p>
  
  <p>This is the code that I've tried using to perform this action.</p>
  
  <p>The line with "HomeButton.prepareForSegueWithIdentifier()" is just an example. It won't actually let me add the "prepareForSegue" part, it doesn't support it &lt;--- What I mean by that is when I go to add it, it is unrecognized.</p>
  
  <pre><code>class GameOverScene: SKScene {
  
       var HomeButton: SKNode! = nil
  
  
      init(size: CGSize, won: Bool) {
          super.init(size: size)
  
          backgroundColor = SKColor.whiteColor()
  
          HomeButton = SKSpriteNode(color: SKColor.blueColor(), size: CGSize(width: 100, height: 100))
          HomeButton.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame))
          HomeButton.userInteractionEnabled = true
          self.addChild(HomeButton)
  
          let message = won ? "You Won!" : "You Lose!"
  
  
  
  
  
          let label = SKLabelNode(fontNamed: "Title 1")
          label.text = message
          label.fontSize = 40
          label.fontColor = SKColor.blackColor()
          label.position = CGPoint(x: size.width/2, y: size.height/2)
          addChild(label)
  
          runAction(SKAction.sequence([SKAction.waitForDuration(3.0), SKAction.runBlock() {
              let reveal = SKTransition.flipHorizontalWithDuration(0.5)
              let scene = GameScene(size: size)
              self.view?.presentScene(scene, transition: reveal)
          }
          ]))
  
  
      }
  
      override func touchesEnded(touches: Set&lt;UITouch&gt;, withEvent event: UIEvent?) {
          for touch: AnyObject in touches {
              let location = touch.locationInNode(self)
  
              if HomeButton.containsPoint(location) {
  
                  HomeButton.prepareForSegueWithIdentifier()
  
              }
          }
      }
  </code></pre>
  
  <p>Note: I've tried using a button, but they don't work in and SKScene.</p>
  
  <p>I'll be on to respond if there is any confusion.</p>