photokit

Implement iOS photo picking, camera capture, and media handling with PhotoKit and AVFoundation.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill photokit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: photokit
Source: https://github.com/DFly7/iOS-FastAPI-Supabase-AI/tree/main/.agents/skills/photokit
Command: npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill photokit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Modern iOS apps need correct, performant, and privacy-conscious patterns for picking photos, capturing from the camera, loading large images, and handling media playback; this Skill consolidates best practices, common pitfalls, and production-ready architectures so engineers avoid memory, permission, and lifecycle mistakes.

Core Features & Use Cases

  • Photo picking: PhotosPicker and PHPickerViewController patterns for single and multi-selection without unnecessary permission prompts.
  • Camera capture: AVCaptureSession ownership patterns, async photo capture bridging, video recording, torch/flash control, focus/exposure, and orientation handling.
  • Image loading & performance: Downsampling with ImageIO, in-memory and URLCache strategies, prefetching for grids, HEIF/HEIC handling, and compression-before-upload guidelines.
  • Permissions & privacy: Explicit checks and Info.plist requirements, denial handling with Settings deep links, and guidance for add-only vs read-write access.
  • Playback & audio: AVPlayer, AVAudioSession, background audio, Now Playing integration, and Picture-in-Picture support.

Quick Start

Implement a PhotosPicker-backed selection flow, downsample selected images before display, and add camera capture using a dedicated camera manager with permission checks and start/stop lifecycle handling.

Frequently Asked Questions about photokit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement SwiftUI PhotosPicker without triggering unnecessary permission prompts?

SwiftUI PhotosPicker can be implemented for single and multi-selection without permission prompts by using async transferable loading. This approach avoids memory and lifecycle mistakes by fetching data on demand rather than requiring full photo library access.

What's the best way to manage AVCaptureSession lifecycle for iOS camera capture?

AVCaptureSession lifecycle management requires a dedicated camera manager to handle session start and stop routines. You must configure async photo capture bridging, torch or flash control, focus and exposure, and orientation handling to ensure stable video recording.

Do I need Info.plist privacy keys for both photo picking and camera capture?

Yes, Info.plist privacy keys are required for camera capture and media handling. Explicit permission checks with denial handling and Settings deep links are necessary, while distinguishing between add-only and read-write access for privacy compliance.

How do I downsample large images using ImageIO before display?

Downsampling large images uses CGImageSource from ImageIO to reduce memory footprint before display. This strategy pairs with in-memory and URLCache storage, prefetching for grids, and HEIF or HEIC handling to optimize image loading performance.

Does AVPlayer work with AVAudioSession for background audio and Picture-in-Picture?

AVPlayer and AVAudioSession configuration supports background audio, Now Playing integration, and Picture-in-Picture support. Proper media playback setup ensures continuous audio routing and video display when the app enters background states.

Why does PHPickerViewController require different permissions than direct photo library access?

PHPickerViewController operates without requiring full photo library permissions because it uses a system-provided picker interface. This privacy-conscious pattern allows single and multi-selection while keeping user media data protected within the system sandbox.