$ show banchichen/TZImagePickerController
TZImagePickerController is an iOS library providing a customizable image and video picker controller as a replacement for UIImagePickerController. It features multi-selection, media preview, cropping, video trimming, GIF playback, and original photo selection. The architecture is modular with a main controller (TZImagePickerController) managing navigation, photo browsing (TZPhotoPickerController), preview (TZPhotoPreviewController), and asset management (TZImageManager). Key dependencies include the Photos framework, FLAnimatedImage for GIFs, and optional location services. The library emphasizes customization through appearance properties, UI configuration blocks, and delegate patterns.
The LLM identified 3 files worth highlighting for reuse:
High-performance GIF player with smart frame caching based on image size/memory constraints. Handles memory warnings via adaptive cache resizing and uses predrawing for smooth playback. Demonstrates non-obvious skill in efficient GIF decoding and memory management. Self-contained (only depends on UIKit/CoreGraphics) and easily extractable.
Centralized asset manager handling PHAsset fetching, thumbnail/original image caching, and iCloud synchronization error detection. Implements singleton pattern with thread-safe queues for asset requests. Exposes clean API for video export/composition fixing. Low coupling (primarily depends on Photos framework and internal models) making it reusable in other media apps.
UIKit category adding layout helper methods (e.g., tz_width, tz_height, tz_topLeft). Simplifies frame calculations without external dependencies. Highly reusable in any iOS project due to isolation and minimal implementation (under 100 lines). Demonstrates practical utility pattern for reducing boilerplate layout code.