$ show Yummypets/YPImagePicker
YPImagePicker is an iOS framework that provides an Instagram-like photo and video picker with a rich set of features including camera capture, library browsing, video trimming, photo filters, cropping, and multiple selection. The architecture follows a modular pattern with a central configuration struct (YPImagePickerConfiguration) that controls all behaviors, and a navigation controller (YPImagePicker) that manages a paged interface (YPPickerVC) switching between library, photo, and video screens. The library screen uses PHPhotoLibrary and PHCachingImageManager for asset fetching and caching, while the camera and video screens leverage AVFoundation for capture. Filters are applied via Core Image, and video trimming uses the PryntTrimmerView dependency. The framework is highly customizable through configuration properties for colors, fonts, icons, wordings, and feature toggles. The codebase is well-organized into folders for configuration, filters, helpers, models, pages (gallery, photo, video), and selections gallery. Helper extensions provide reusable functionality for AVFoundation, Photos, UIKit, and Core Image operations. The permission management is abstracted into a dedicated module. While the framework lacks unit tests and some view controllers are large, the overall structure is clean and the separation of concerns is reasonable. The library has been widely adopted (4.4k stars) and is actively maintained with recent commits and pinned dependencies.
The LLM identified 4 files worth highlighting for reuse:
Defines a YPFilter struct with a name and an optional FilterApplierType closure that takes a CIImage and returns a filtered CIImage. Includes static methods for common Instagram-like filters (Nashville, Toaster, 1977, Clarendon) implemented using Core Image filters and blend modes. This component is self-contained, depends only on UIKit and CoreImage, and can be extracted to apply custom image filters in any iOS project.
Provides a static method trySaveImage(_:inAlbumNamed:completion:) that saves a UIImage to a named photo album, creating the album if it doesn't exist. Uses PHPhotoLibrary and PHAssetCollection APIs. This is a standalone utility with no internal dependencies, making it directly reusable in any iOS app that needs to save images to a specific album.
Encapsulates permission checks for photo library, camera, and microphone access. Provides static methods that check authorization status and request access if needed, presenting a denial popup that directs users to Settings. Handles iOS 17+ microphone API changes. This module has no internal dependencies and can be reused across any iOS project requiring permission management.
A singleton that uses CMMotionManager to detect device orientation changes via accelerometer data. Provides a start/stop notifier with a callback for orientation changes. This is a self-contained utility with no internal dependencies, reusable for any iOS app that needs real-time orientation detection without relying on UIDevice orientation notifications.