This plugin provides APIs for sharing content from your Tauri application on iOS platforms.
Install the Core plugin by adding the following to your Cargo.toml file:
[dependencies]
tauri-plugin-sharing = { git = "https://github.com/inkibra/tauri-plugins", tag = "@inkibra/tauri-plugin-sharing@VERSION", package="tauri-plugin-sharing" }Before installing the JavaScript bindings, you need to configure npm to use the GitHub Packages registry for the @inkibra scope. Run the following command:
npm config set @inkibra:registry https://npm.pkg.github.comFor yarn users:
yarn config set @inkibra:registry https://npm.pkg.github.comFor pnpm users:
pnpm config set @inkibra:registry https://npm.pkg.github.comAfter setting the registry, you can install the JavaScript Guest bindings using your preferred JavaScript package manager:
npm add @inkibra/tauri-plugin-sharing
# or
yarn add @inkibra/tauri-plugin-sharing
# or
pnpm add @inkibra/tauri-plugin-sharingNote: If you're using a monorepo with Lerna, make sure to set the registry in your root .npmrc file or use Lerna's scoped registry configuration.
First, you need to register the core plugin with Tauri:
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_sharing::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}Afterward, you can use the plugin in your JavaScript code:
share(text: string, url: string): Promise<void>- Shares the provided text and URL using the native iOS sharing sheet.
No additional setup is required for iOS. The plugin uses the built-in UIActivityViewController for sharing.
Here's a basic example of how to use the plugin:
import { share } from '@inkibra/tauri-plugin-sharing';
// Share some text and a URL
try {
await share("Check out this cool app!", "https://example.com");
console.log("Content shared successfully");
} catch (error) {
console.error("Failed to share content:", error);
}This plugin follows Tauri's security recommendations and implements the following features:
- Permission-based access to plugin functionality
- Sandboxed execution on supported platforms
For more details, check the permissions folder in the plugin's repository.
We welcome contributions to this plugin! Please feel free to submit issues and pull requests.
This plugin is licensed under either of:
- Apache License, Version 2.0
- MIT license
at your option.
This plugin is maintained by the Inkibra team and the Tauri community.