| Crates.io | tauri-plugin-ios-photos |
| lib.rs | tauri-plugin-ios-photos |
| version | 0.3.0 |
| created_at | 2025-12-25 02:00:39.629849+00 |
| updated_at | 2025-12-31 02:56:29.072624+00 |
| description | Access iOS user device photo library. |
| homepage | |
| repository | https://github.com/Gbyte-Group/tauri-plugin-ios-photos |
| max_upload_size | |
| id | 2004089 |
| size | 191,094 |
A Tauri plugin for accessing and managing iOS Photos albums and assets using the native Photos framework.
This plugin allows Tauri applications to request photo permissions, read albums, access photos, and perform basic album/photo management on iOS devices.
⚠️ iOS only. This plugin relies on Apple Photos APIs and is not available on other platforms.
Info.plistThis plugin requires access to the user’s photo library.
Make sure the following keys are added to your iOS Info.plist:
<key>NSPhotoLibraryUsageDescription</key>
<string>Allow access to your photo library</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Allow saving photos to your photo library</string>
pnpm add @gbyte/tauri-plugin-ios-photos
# or
npm install @gbyte/tauri-plugin-ios-photos
# or
yarn add @gbyte/tauri-plugin-ios-photos
Add the plugin to your Tauri project's Cargo.toml:
[dependencies]
tauri-plugin-ios-photos = "0.3"
Or use cargo add tauri-plugin-ios-photos.
Configure the plugin permissions in your capabilities/default.json:
{
"permissions": [
"ios-photos:default"
]
}
Register the plugin in your Tauri app:
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_ios_photos::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
import {
requestPhotosAuth,
PhotosAuthorizationStatus,
requestAlbums,
PHAssetCollectionType,
PHAssetCollectionSubtype
} from '@gbyte/tauri-plugin-ios-photos'
let photoAuth = ''
let albums = []
requestPhotosAuth()
.then((status) => {
switch (status) {
case PhotosAuthorizationStatus.authorized:
photoAuth = 'authorized'
break
case PhotosAuthorizationStatus.denied:
photoAuth = 'denied'
break
case PhotosAuthorizationStatus.limited:
photoAuth = 'limited'
break
case PhotosAuthorizationStatus.restricted:
photoAuth = 'restricted'
break
case PhotosAuthorizationStatus.notDetermined:
photoAuth = 'notDetermined'
break
}
})
.then(() => {
requestAlbums({
with: PHAssetCollectionType.smartAlbum,
subtype: PHAssetCollectionSubtype.albumRegular
}).then((value) => {
albums = value
})
})
The image paths returned by this plugin are local file paths, typically pointing to internal iOS sandbox locations.
In Tauri (especially on iOS / WebView environments), these local paths cannot be accessed directly by the frontend (e.g. via file:// or raw filesystem paths). This is due to WebView security and sandbox restrictions.
Before using these images in the frontend, you must expose them through a Tauri custom protocol (URI scheme) so they can be accessed as normal URLs.
Recommended approach:
Register a custom URI scheme in Tauri (for example, temp://)
When the frontend requests temp://
Tauri reads the corresponding local file
Returns the binary data with the correct MIME type
⚠️ Notes:
This plugin does not automatically convert local paths into accessible URLs
Implementing the custom protocol is the responsibility of the application
For security reasons, it is recommended to restrict the accessible path scope
Possible authorization states:
notDeterminedrestricteddeniedauthorizedlimitedThe plugin exposes APIs to query and react to these states.
MIT