title: Open Facebook profile in app
body: <p>I am trying to make that when the user press Facebook button, it opens the Facebook application, or in browser.</p>
  
  <p>Import code:</p>
  
  <pre><code>import Foundation
  </code></pre>
  
  <p>Extension code:</p>
  
  <pre><code>extension UIApplication {
      class func tryURL(urls: [String]) {
          let application = UIApplication.sharedApplication()
          for url in urls {
              if application.canOpenURL(NSURL(string: url)!) {
                  application.openURL(NSURL(string: url)!)
                  return
              }
          }
      }
  }
  </code></pre>
  
  <p>Function code:</p>
  
  <pre><code>func fimageTapped()
  {
      UIApplication.tryURL([
          "fb://profile/1357163924", // App
          "http://www.facebook.com/1357163924" // Website if app fails
          ])
  }
  </code></pre>
  
  <p>I get error at line:</p>
  
  <pre><code>class func tryURL(urls: [String]) {
  </code></pre>
  
  <p>Error message:</p>
  
  <blockquote>
    <p>Invalid redeclaration of "tryURL"</p>
  </blockquote>
  
  <p>This is where i found the code from: <a href="https://stackoverflow.com/questions/29376673/xcode-swift-link-to-facebook-page">Xcode swift link to facebook page</a></p>
  
  <p>Anyone has any idea what is wrong here?</p>