title: Unified openURL for framework + app + extension
body: <p>I have a Swift application for iOS 8 that has an app component, an extension component, and a framework that contains a lot of shared resources - shared view controllers, shared assets, etc. At one point in the framework, I want to call</p>
  
  <pre><code>UIApplication.sharedApplication().openURL(someURL)
  </code></pre>
  
  <p>But if I do that when "Allow app extension API only" is checked, it errors because UIApplication.sharedApplication() is unavailable in extensions. If I uncheck that box, I get a warning that it may be unsafe to include the framework in the extension, and I'm worried that may lead to a rejection when it comes to submission time.</p>
  
  <p>If this code were only used in extensions, I would use something like:</p>
  
  <pre><code>extensionContext.openURL(someURL, completionHandler: nil)
  </code></pre>
  
  <p>…but that doesn't work in standalone apps, only in extensions.</p>
  
  <p>It's trivial to amend my code to ensure that the UIApplication.sharedApplication().openURL() line is never called by the extension, and the extensionContext.openURL() line is never called by the app, but that doesn't clear up the error - merely the presence of UIApplication.sharedApplication() in an extension API framework causes the error.</p>
  
  <p>So, before I start looking into hacks, is there a clean solution that lets me called openURL and takes the correct action, without causing compile errors?</p>
  
  <p>Thanks in advance!</p>