What I want
I\'m trying to achieve the following user flow:
Swift 3
Try something along the lines of:
override func didSelectPost() {
if let item = extensionContext?.inputItems.first as? NSExtensionItem,
let itemProvider = item.attachments?.first as? NSItemProvider,
itemProvider.hasItemConformingToTypeIdentifier("public.url") {
itemProvider.loadItem(forTypeIdentifier: "public.url", options: nil) { (url, error) in
if let shareURL = url as? URL {
// do what you want to do with shareURL
}
self.extensionContext?.completeRequest(returningItems: [], completionHandler:nil)
}
}
}
"public.url"
can be replaced with the kUTTypeURL
String imported from MobileCoreServices