photokit

Streamline iOS photo picking and camera capture with PhotoKit and AVFoundation.

Updated May 10, 2026
One-click install
npx skills add https://github.com/FelixRauch/medat-figuren --skill photokit-felixrauch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: photokit
Source: https://github.com/FelixRauch/medat-figuren/tree/main/.agents/skills/photokit
Command: npx skills add https://github.com/FelixRauch/medat-figuren --skill photokit-felixrauch

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill reduces the complexity and common failure points of picking photos, capturing images or video, loading media efficiently, and requesting the right iOS privacy permissions without crashing or blocking the UI.

Core Features & Use Cases

  • PhotosPicker and PHPickerViewController patterns: Choose single or multiple photos and filter by media type (images, videos, live photos, screenshots) using modern SwiftUI-friendly APIs.
  • Asynchronous media loading and rendering: Load selected assets via Transferable, present them in SwiftUI, and downsample large images to avoid memory spikes.
  • Camera capture with AVFoundation: Configure and run AVCaptureSession models, preview with a SwiftUI representable, capture photos, record video, and handle camera permissions.
  • Privacy and permissions guardrails: Request/check photo library and camera access correctly, guide users when denied, and ensure Info.plist usage keys are present.

Quick Start

Implement photo picking with PhotosPicker and load the chosen image asynchronously, then downsample it before rendering in a SwiftUI grid or detail view.

Frequently Asked Questions about photokit

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

FAQPage Schema
How do I implement PhotosPicker in SwiftUI to load images asynchronously?

PhotosPicker in SwiftUI loads images asynchronously using the Transferable protocol, allowing selected assets to be fetched and rendered without blocking the UI. This skill streamlines async media loading and downsampling to prevent memory spikes.

What's the best way to handle camera permissions and AVCaptureSession lifecycle in Swift?

Handling camera permissions and AVCaptureSession lifecycle safely requires requesting access via proper Info.plist keys and controlling session start/stop to avoid crashes. This skill provides guardrails for AVFoundation camera preview, capture, and recording workflows.

How do I downsample large images from PhotoKit to avoid memory spikes in iOS?

Downsampling large images from PhotoKit avoids memory spikes by using CGImageSource to load media efficiently at reduced dimensions. This skill applies memory-efficient image downsampling before rendering selected assets in SwiftUI views.

Can I filter PHPickerViewController results by media type for multi-selection?

PHPickerViewController supports filtering by media type for multi-selection, allowing you to choose images, videos, live photos, or screenshots. This skill implements modern SwiftUI-friendly APIs for single or multiple photo picking with asset filtering.

Why does my iOS app crash when accessing the photo library without Info.plist keys?

Accessing the photo library without proper Info.plist privacy usage keys causes crashes because iOS restricts unauthorized photo library access. This skill ensures correct permission handling and guides users when access is denied.