In this tutorial, I want to show you how to use the Capacitor Share API into your Ionic project and how it will work in IOS app.
To follow this tutorial you should have the basic fundamentals of the command line, installed Node, Ionic, Capacitor All the following was done with the next requirements: Node v9.10.0, Ionic v4.0.6, Capacitor v1.0.0-beta6
Important: In this tutorial, we used Capacitor version beta, so it’s not production ready.
In this step, you need to use everything described in this official documentation of Capacitor. We will use the capacitorShareExample as appName (also for Ionic project too)and com.roma.capacitorShareExample as appId. On the step of adding platforms, we will add IOS.
Let’s go to the project folder and open the src/app/pages/home/home.ts file. We will include Capacitor Share API and ShareOptions interface to this component and create a simple method to share data
Modify src/app/pages/home/home.ts to reflect the following: