Implement, review, or improve photo picking, camera capture, and media handling in iOS apps using PhotoKit and AVFoundation. Use when working with PhotosPicker, PHPickerViewController, camera capture sessions (AVCaptureSession), photo library access, image loading and display, video recording, or media permissions. Also use when selecting photos from the library, taking pictures, recording video, processing images, or handling photo/camera privacy permissions in Swift apps.
Modern iOS patterns for photo picking, camera capture, image loading, and media permissions using PhotoKit and AVFoundation. It targets iOS 26+ with Swift 6.3 while remaining backward-compatible to iOS 16 unless noted, and applies when working with PhotosPicker, PHPickerViewController, AVCaptureSession, photo library access, image display, video recording, or media privacy permissions.
The centerpiece is PhotosPicker, the native SwiftUI replacement for UIImagePickerController. Because it runs out-of-process, it requires no photo library permission to browse and only grants access to the items the user selects. The skill shows single-selection and multi-selection pickers (with maxSelectionCount), media-type filtering via PHPickerFilter composites such as .images, .videos, .livePhotos, and .screenshots plus combinations like .any(of:) and .all(of: [.images, .not(.screenshots)]), and asynchronous item loading through loadTransferable(type:), including defining a custom Transferable type with a DataRepresentation. Loading is always done inside a Task to avoid blocking the main thread, with nil and error handling for undecodable formats.
The privacy section explains the two photo library access levels, add-only (NSPhotoLibraryAddUsageDescription) and read-write (NSPhotoLibraryUsageDescription), and when each is needed, noting that the system automatically presents the limited-library picker for .readWrite requests. It provides async helpers for checking and requesting PHPhotoLibrary and AVCaptureDevice authorization, a ContentUnavailableView-based pattern for guiding users to Settings when access is denied, and a table of required Info.plist keys including NSCameraUsageDescription and NSMicrophoneUsageDescription. Additional reference files cover complete picker recipes and AVCaptureSession camera patterns. Use it to implement, review, or improve any photo, camera, or media-handling feature in a Swift app while following current permission and concurrency best practices.
No. PhotosPicker runs out-of-process and requires no permission to browse; it only grants access to the items the user selects. Request explicit permission only when reading the full library or saving photos.
It targets iOS 26+ with Swift 6.3, and its patterns are backward-compatible to iOS 16 unless a specific note says otherwise.
Use PHPickerFilter composites with the matching parameter, such as .images, .videos, .livePhotos, .screenshots, or combinations like .any(of: [.images, .videos]) and .all(of: [.images, .not(.screenshots)]).
NSPhotoLibraryUsageDescription for reading the library, NSPhotoLibraryAddUsageDescription for saving, NSCameraUsageDescription for camera access, and NSMicrophoneUsageDescription for microphone use such as recording video with audio.
Guide them to Settings rather than repeatedly prompting or hiding functionality silently. The skill shows a ContentUnavailableView with an Open Settings button using UIApplication.openSettingsURLString.
Quick Setup:
.claude/skills/Repository
dpearson2699/swift-ios-skills