title: Open My application from my keyboard extension in swift 3.0
body: <p>I am trying to open from my keyboard extension. I am having custom keyboard and I have add that keyboard from setting. On my custom keyboard there is one button “Show More”, and I want to open my app on this button click.</p>
  
  <p>So I have tried following code : </p>
  
  <pre><code>let context = NSExtensionContext()
   context.open(url! as URL, completionHandler: nil)
  
   var responder = self as UIResponder?
  
   while (responder != nil) {
  
        if responder?.responds(to: Selector("openURL:")) == true {
  
             responder?.perform(Selector("openURL:"), with: url)
        }
        responder = responder!.next
   }
  </code></pre>
  
  <p>It is working successfully, but as we know in swift <code>Selector("method_name:")</code> is deprecated and use <code>#selector(classname.methodname(_:))</code> instead so it is giving warning. And I want to solve that warning. So I have tried as Xcode automatically suggested : </p>
  
  <pre><code> if responder?.responds(to: #selector(UIApplication.openURL(_:))) == true {
  
        responder?.perform(#selector(UIApplication.openURL(_:)), with: url)
   }
  </code></pre>
  
  <p>Also tried :</p>
  
  <pre><code> if responder?.responds(to: #selector(NSExtensionContext.open(_:))) == true {
  
        responder?.perform(#selector(NSExtensionContext.open(_:)), with: url)
   }
  </code></pre>
  
  <p>I have also tried others possible ways, but no luck. If anyone know how to do, please let me know.</p>
  
  <p>I referred this link, Julio Bailon’s answer : </p>
  
  <p><a href="https://stackoverflow.com/questions/24297273/openurl-not-work-in-action-extension">openURL not work in Action Extension</a></p>