title: Get selected index tabbar controller Swift
body: <p>I'm trying to get the selected index of the tabbarController.</p>
  
  <pre><code>let application = UIApplication.sharedApplication().delegate as AppDelegate
  let tabbarController = application.tabBarController as UITabBarController
  let selectedIndex = tabBarController.selectedIndex
  </code></pre>
  
  <p>I'm getting this error: <code>'UITabBarController?' does not have a member named 'selectedIndex'</code></p>
  
  <p>Am I missing something?</p>