PHPicker, PhotosPicker, photo selection, limited library access, presentLimitedLibraryPicker, save to camera roll, PHPhotoLibrary, PHAssetCreationRequest, Transferable, PhotosPickerItem, photo permissions
View on GitHubSelect agents to install to:
npx add-skill https://github.com/CharlesWiltgen/Axiom/blob/main/.claude-plugin/plugins/axiom/skills/axiom-photo-library/SKILL.md -a claude-code --skill axiom-photo-libraryInstallation paths:
.claude/skills/axiom-photo-library/# Photo Library Access with PhotoKit Guides you through photo picking, limited library handling, and saving photos to the camera roll using privacy-forward patterns. ## When to Use This Skill Use when you need to: - ☑ Let users select photos from their library - ☑ Handle limited photo library access - ☑ Save photos/videos to the camera roll - ☑ Choose between PHPicker and PhotosPicker - ☑ Load images from PhotosPickerItem - ☑ Observe photo library changes - ☑ Request appropriate permission level ## Example Prompts "How do I let users pick photos in SwiftUI?" "User says they can't see their photos" "How do I save a photo to the camera roll?" "What's the difference between PHPicker and PhotosPicker?" "How do I handle limited photo access?" "User granted limited access but can't see photos" "How do I load an image from PhotosPickerItem?" ## Red Flags Signs you're making this harder than it needs to be: - ❌ Using UIImagePickerController (deprecated for photo selection) - ❌ Requesting full library access when picker suffices (privacy violation) - ❌ Ignoring `.limited` authorization status (users can't expand selection) - ❌ Not handling Transferable loading failures (crashes on large photos) - ❌ Synchronously loading images from picker results (blocks UI) - ❌ Using PhotoKit APIs when you only need to pick photos (over-engineering) - ❌ Assuming `.authorized` after user grants access (could be `.limited`) ## Mandatory First Steps Before implementing photo library features: ### 1. Choose Your Approach ``` What do you need? ┌─ User picks photos (no library browsing)? │ ├─ SwiftUI app → PhotosPicker (iOS 16+) │ └─ UIKit app → PHPickerViewController (iOS 14+) │ └─ NO library permission needed! Picker handles it. │ ├─ Display user's full photo library (gallery UI)? │ └─ Requires PHPhotoLibrary authorization │ └─ Request .readWrite for browsing │ └─ Handle .limited status with presentLimitedLibraryPicker │ ├─ Save photos to camera roll? │ └─ Requires PHP