title: Configure deep links in swift?
body: <p>So I have an app written in swift that I would like to use deep links for. A user would click on one that in the route of the URL had different pieces of information such as the id of the post or the number of likes it has or something like that. I understand that you put this in the AppDelegate:</p>
  
  <pre><code>func application(application: UIApplication,openURL url: NSURL,sourceApplication sourceApplication: String?,annotation annotation: AnyObject?) -&gt; Bool {
      println(url.host as String!)
      return true
  }
  </code></pre>
  
  <p>And that prints everything after <code>appname://</code>. But how can I get <code>url.host</code> to my view controller to be parsed into the information I need. If the declaration of URL was outside of that function then I could use this:</p>
  
  <pre><code>let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
  let InfoFromDeepLink = appDelegate.url.host
  </code></pre>
  
  <p>but since it's inside of that bulky Objective-C function, I'm helpless. How do you do this? I'm completely baffled. I can't even set the function to <code>return url.host</code> because it doesn't allow that. That's what I would do in Javascript. If you also know Javascript maybe put it in terms that a web developer would understand because I'm pretty new to this. This has to be so simple for a Swift developer right? I feel so stupid.</p>