iOS camera, PhotoKit and PhotosUI with AI agents
Prefer Apple's out-of-process Photos picker when people only need to choose a photo, and use AVFoundation only when you need a custom camera UI or live buffers. Have the agent install the apple-media skill, map camera and microphone capabilities before editing Info.plist, and keep full photo-library access off the critical path.
Last updated:
This page is about getting a coding agent to capture photos and video, present a photo picker, and talk to PhotoKit without requesting more privacy access than the feature needs. Store listing screenshots are in the ASO guide; security deep dives in the iOS security guide. A PencilKit canvas, PKDrawing persistence and image(from:scale:) export are not the photo library or camera; see PencilKit with AI agents.
What Apple says about picking and capturing
Pick without library permission. Selecting Photos and Videos in iOS shows the Photos picker and says both
PHPickerViewControllerand the SwiftUI Photos picker "use the out-of-process Photos picker user interface" and that "Apps don’t need to request photo library permission when using either class." Benefits Apple lists include deferred image loading, reliable large assets (RAW, panoramas) and Live Photos without library access.PHPickerViewController. PHPickerViewController is "A view controller that provides the user interface for choosing assets from the photo library."
Custom capture needs AVFoundation. Capture setup says to use the AVFoundation capture subsystem to build a custom camera UI, give direct control of focus, exposure and stabilization, produce RAW or depth results, or get live pixel or audio data. For the system camera UI inside your app, Apple points you at the system camera UI APIs instead.
Rules for AGENTS.md
markdown
## Camera and photos
- Default to PhotosPicker / PHPickerViewController. Do not add NSPhotoLibraryUsageDescription unless full library access is required and approved.
- Before opening an AVCaptureSession, confirm NSCameraUsageDescription and NSMicrophoneUsageDescription match the feature.
- One capability change per step; rebuild after Info.plist or entitlement edits.
- Never invent camera device types; read AVCaptureDevice.DiscoverySession results on a device or simulator that has a camera.Step 1: install apple-media, not the whole monorepo by default
Ask the agent to install Apple Native Skills with the media skill only:
npx skills add Yar177/appleNativeSkills --skill apple-media
That skill covers AVFoundation, AVKit, PhotoKit and VideoToolbox capture, playback and photo-library access per the README. Install apple-ai only if you also need Vision or speech.
Step 2: map capabilities before touching Info.plist
Run iOS Capability Architect (npx skills add https://github.com/fillbyte/skills --skill ios-capability-architect) so the agent maps camera, microphone and photo-library requirements to documented capabilities and configuration evidence instead of guessing keys.
Step 3: pick first, capture second
For "set a profile photo" or "attach an image", implement PhotosPicker / PHPicker first. Only then, if the product needs a custom shutter, add an AVCaptureSession. The heyimjames camera-and-photos skill reviews shutter size, haptics and focus-ring chrome.
Step 4: verify on a device with a camera
Simulators often have no real camera. Have the agent build to a device, refuse to mark capture "done" on simulator-only runs, and confirm the usage strings appear in the system prompt.
Tools compared (5)
| Tool | Best for | Agents (README) | Install (README) | License | Stars | Last push |
|---|---|---|---|---|---|---|
Apple Native Skills (Yar177) — apple-media | AVFoundation / PhotoKit capture, playback, photo-library access | Claude Code, Cursor, Codex, Gemini, Windsurf | npx skills add Yar177/appleNativeSkills --skill apple-media | MIT | 0 | 17 Jun 2026 ⚠ |
| iOS Capability Architect (fillbyte) | Map camera/mic/library product requirements to capabilities and Xcode evidence | Claude Code, Cursor, Codex | npx skills add https://github.com/fillbyte/skills --skill ios-capability-architect | MIT | 1 | 4 Nov 2026 |
iOS Design Skills (heyimjames) — camera-and-photos | Design-engineering taste for camera shutter, focus and photo flows | Claude Code (marketplace) | /plugin marketplace add heyimjames/ios-design-skills then /plugin install heyimjames@heyimjames | MIT | 7 | 10 Jun 2026 ⚠ |
| Apple Design Skill (XOVIET-GAME) | HIG reference, tokens and an automated HIG audit CLI for camera chrome | Claude Code, Codex, Cursor, Antigravity | npx skills add XOVIET-GAME/apple-design-skill -g | MIT | 6 | 1 Nov 2026 |
| Apple Privacy Manifest Agent Skill (enoktate) | PrivacyInfo.xcprivacy and required reason API audit when the app goes beyond the picker. See iOS privacy manifests with AI agents | Codex, Claude Code | npx skills add https://github.com/enoktate/Privacy-Manifest-Agent-Skill --skill apple-privacy-manifest | MIT | 0 | 23 Jun 2026 ⚠ |
⚠ = no push for more than 4 weeks.
Which one to pick:
Implement capture or PhotoKit: Apple Native Skills (
apple-media).Entitlements and usage strings: iOS Capability Architect.
Camera app UI polish: heyimjames camera-and-photos.
HIG audit of the chrome: Apple Design Skill.
A prompt that keeps the agent honest
Setting up the agent itself: Claude Code for iOS development, Codex for iOS development. Privacy review: iOS security with AI agents.
Do not edit Info.plist yet. For this feature, say whether PhotosPicker/PHPickerViewController is enough or whether we need AVFoundation capture. Quote Apple's picker guidance if we can avoid photo library permission. List the exact usage description keys and capabilities required, with the Apple doc link for each. Then outline the smallest AVCaptureSession or picker implementation and stop for approval.
FAQ
- Does my app need photo library permission to let people pick a photo?
- Not if you use Apple's out-of-process Photos picker. Apple's Selecting Photos and Videos in iOS sample says apps don't need to request photo library permission when using PHPickerViewController or the SwiftUI PhotosPicker, and that this improves stability for large assets such as RAW and panoramas.
- When should an agent use AVFoundation instead of the system camera UI?
- When you need a custom camera UI, direct control of focus, exposure or stabilization, RAW or depth output, or live pixel access. Apple's Capture setup article says to use the AVFoundation capture subsystem for those cases, and to use the system camera UI when you only need the standard shoot-and-return flow.
- Which usage description strings does a camera app need?
- A capture session that uses the camera or microphone needs the matching Info.plist usage strings before the system grants access. Have the agent map the product to capabilities with iOS Capability Architect and avoid requesting full photo library access when PHPicker is enough.
- Can an AI agent design a camera shutter and focus UI?
- Yes, as taste guidance, not as a substitute for device testing. The heyimjames camera-and-photos skill (after the next catalog merge) is a design-engineering skill aimed at Halide-class camera chrome; pair it with apple-media for the AVFoundation and PhotoKit implementation.
- Which camera skill should I install first?
- Install Apple Native Skills with --skill apple-media for capture, playback and photo-library patterns. Add iOS Capability Architect so the agent does not invent entitlements. After the next merge, add the heyimjames camera-and-photos skill when the UI has to feel like a camera app, not a form.