title: Showing keyboard on SKScene and performing action on a sprite node based on key tapped
body: <p>I am trying to learn SpriteKit and play with some simple sample apps. </p>
  
  <p>Currently I am trying to achieve below things:</p>
  
  <ol>
  <li>Show keyboard over SKScene</li>
  <li>If user taps 'A', perform some action on a sprite node, if user taps 'B' perform some other action on other sprite nodes</li>
  </ol>
  
  <p>To achieve 1st requirement I tried below steps:</p>
  
  <p><strong>Step 1:</strong> In GameViewController.swift, added a reference to the view.</p>
  
  <pre><code>var keyView: KeyboardDummyView?
  </code></pre>
  
  <p><strong>Step 2:</strong> In viewDidLoad(), created the view, assigned it to the ivar, and added it to the controller's view. Also assigned "self" to a backreference ivar in GameScene.</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene {
          // So scene can forward touch event back here.
          scene.gvc = self
  
          // Other config
  
          keyView = KeyboardDummyView(frame: self.view.frame)
           self.view.addSubview(keyView!)
      }
  }
  </code></pre>
  
  <p><strong>Step 3:</strong> Added a function to handle a tap/touch.</p>
  
  <pre><code>func handleTap() {
      // Show the keyboard
      keyView!.becomeFirstResponder()
  }
  </code></pre>
  
  <p><strong>Step 4:</strong> In GameScene.swift added the reference to the controller.</p>
  
  <pre><code>var gvc: GameViewController?
  </code></pre>
  
  <p><strong>Step 5:</strong> In touchesBegan handled tap.</p>
  
  <pre><code>gvc!.handleTap()
  </code></pre>
  
  <p>But for some reasons it is not showing the keyboard when screen is tapped :(</p>
  
  <p>Here is the code base: <a href="https://github.com/Daemon-Devarshi/KeyboardOverSKScene" rel="nofollow">KeyboardOverSKScene</a> </p>
  
  <p>Please suggest if I am doing any thing wrong?</p>
  
  <p><strong><em>Note:</strong> I am trying this in Xcode 6.0.1</em></p>