photokit

Implement PhotosPicker selection, AVCaptureSession capture, and permission handling in Swift 6.

Updated May 6, 2026
One-click install
npx skills add https://github.com/Roy-wonji/claude-config --skill photokit-roy-wonji
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: photokit
Source: https://github.com/Roy-wonji/claude-config/tree/main/skills/swift-ios-skills/skills/photokit
Command: npx skills add https://github.com/Roy-wonji/claude-config --skill photokit-roy-wonji

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Photo picking, camera capture, and media handling often fail in subtle ways—like incorrect permissions, inefficient image loading, memory spikes, or broken previews—causing slow UX and unstable apps.

Core Features & Use Cases

  • SwiftUI Photo Picking with PhotosPicker: Select images with single or multi-selection, apply media filters, and load content asynchronously.
  • Camera Capture with AVCaptureSession: Configure and run a camera session, render a live preview, and safely start/stop capture while respecting threading.
  • Privacy, Permissions, and Info.plist Guardrails: Implement correct photo library and camera permission flows and required usage description keys.
  • Efficient Image Loading & Memory Safety: Downsample large user-selected photos to avoid decoding huge bitmaps and reduce crashes.

Quick Start

Use the photokit skill to design a SwiftUI screen where users can select up to 5 photos with PhotosPicker, asynchronously load selected images, downsample them for thumbnails, and ensure the app handles camera and photo library permissions correctly.

Frequently Asked Questions about photokit

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

FAQPage Schema
How do I use SwiftUI PhotosPicker to load and display selected images asynchronously?

PhotosPicker uses PhotosPickerItem loadTransferable in tasks to asynchronously load selected images in SwiftUI. You define Transferable representations to safely transfer and decode image data into your app's state for display.

How can I prevent memory spikes when loading large user-selected photos in iOS?

Downsample large user-selected photos using CGImageSource to control memory and avoid decoding huge bitmaps. This technique reduces memory spikes and prevents crashes when handling high-resolution media.

How do I configure AVCaptureSession for live camera preview and capture in Swift?

Configure AVCaptureSession by defining inputs and outputs, rendering a live preview, and managing the session lifecycle. You must safely start and stop capture while respecting threading constraints to ensure stable camera operation.

What Info.plist privacy keys are required for photo library and camera permissions on iOS?

Photo library and camera permissions require specific Info.plist usage description keys. Implementing correct permission flows with these guardrails ensures your app requests access properly without crashing or being rejected by App Store review.

Can I implement multi-selection and media filtering with PHPickerViewController in SwiftUI?

PhotosPicker in SwiftUI supports selecting images with single or multi-selection configurations. You can apply media filters to restrict selection to specific content types like images or videos for precise media picking workflows.

Why does my AVCaptureSession crash when starting capture on a background thread?

AVCaptureSession crashes occur when threading is not managed safely during session configuration and capture. You must handle the session lifecycle and dispatch start and stop operations correctly to respect threading constraints.