What I want
On an Iphone, when visiting a website inside Safari or Chrome, it is possible to share content to other apps. In this case, you can see
Following up on the iOS 10 update remark by Aaron Rosen, here's the process to make it work :
In the code from the original answer by Sebastien Lorber, update the doOpenUrl function as suggested by Aaron. Reposting here for clarity:
private func doOpenUrl(url: String) {
let url = NSURL(string:url)
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
}
}
Follow the process outlined in the initial answer to create the extension in Xcode
Only then will the extension work.