pumm3l
pumm3l

Reputation: 65

Sharing an image/link to my app in IOS

I'm trying to find out how I can add sharing support to my app using React Native. I've found documentation for displaying the action sheet from within my app but nothing on how I can add support for users to share images/links to my app. I'm not even sure what Apple calls this feature so it's possible I may not be searching with the right keywords.

e.g. screenshot

On #1 if you press the share button at the bottom middle of the safari app it will bring up a popup where you can choose an app e.g. Facebook, then if you press on Facebook it will open Facebook with a url to the page you want to share from safari where you can add a comment about the link. I want to replicate this behavior but within my own app. I want my app to be available to choose when I press the share button on the safari app which I will then open a popup window that displays the link the user wants to share allowing them to add a comment before posting the link. Is this possible with react native? I see that I have the option share with other apps (my fidelity app, sears shop your way, etc so It seems like you can have a non system app do this.

Upvotes: 2

Views: 5098

Answers (1)

MattWright
MattWright

Reputation: 152

They are called Share extensions and they are part of the Extensibility features. They are system-wide Share Sheets. Not to be mistaken with Action Extensions.

  • Share extensions have colored icons.
  • Action extensions use monochromatic icons.

Anyway the links do not display UNTIL you have clicked the app in the share sheet.

  1. Editor > Add Target > iOS > Application Extension > Share Extension
  2. Configure the App Group for your app target.
  3. On the Capabilities tab, turn on the App Groups switch and select the group you created. (if you want to enable code sharing between the extension and container app you can put the code in a framework and link to it)
  4. Expand the group you created and you will see a storyboard file, an entitlements file, a view controller and a plist file under the Supporting Files group.
  5. You can use the storyboard file to create a custom interface or do it programatically but Share extensions come with a default compose view that looks like the Facebook and Twitter views.

Upvotes: 7

Related Questions