How to create a share extension only for sharing image an text (Dont want video to be shared)

527 Views Asked by At

I am having a social media Application and I want to share images from other social media such as Whatsapp,FB and Instagram to my app. I am able to create a share extension please check the screenshot

Now I need 2 things

  1. How to store image details(Tried with userdefault but storing big image with userdefault is not food right)
  2. I want to make this share extension only for sharing images and text(don't want video)

i am able to get the text from

 override func didSelectPost() {
    // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.

    // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.
    print(self.textView.text)
   
    self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
}
1

There are 1 best solutions below

0
Fabio On

If I look at your screenshots, I see that you are sharing a website to your app. I'm not sure if that's what you want, as you wrote you want to only share Images. However if you want to get the image of the website you are sharing, then you have to forward the url of the website and then load it and take a screenshot of it.

For fetching meta data of a website you could have a look into this: https://developer.apple.com/documentation/linkpresentation