$ show lexrus/LTMorphingLabel
LTMorphingLabel is a mature, well-crafted iOS/tvOS library that provides a UILabel subclass with animated text morphing effects. It supports seven distinct effects (scale, evaporate, fall, pixelate, sparkle, burn, anvil) implemented via a plugin-like extension system. The core animation engine uses CADisplayLink for frame-by-frame animation, character-level diffing (via an efficient string diff algorithm) to determine transition states, and custom Core Graphics drawing for each character. Particle effects (sparkle, burn, anvil) leverage CAEmitterLayer for real-time particle systems. The library also includes a SwiftUI wrapper (MorphingText) for iOS 13+. The codebase is clean, modular, and well-documented, with unit and UI tests. While it remains a solid solution for iOS animation, its minimum deployment target (iOS 9.0) and some legacy Swift patterns (e.g., dynamic method invocation, custom comparison operators) indicate a moderate degree of technical drift.
The LLM identified 3 files worth highlighting for reuse:
Provides a set of reusable easing functions (easeOutQuint, easeInQuint, easeOutBack, easeOutBounce) implemented as static methods on a struct. This is a self-contained, standalone utility that can be extracted and used in any animation project without modification. It demonstrates non-obvious skill in implementing custom easing curves.
Implements a character-level diff algorithm on String via an extension. It returns an array of LTCharacterDiffResult enums (same, add, delete, move, moveAndAdd, replace) along with a skip-drawing array. This is a standalone, reusable component for computing textual differences, applicable beyond morphing labels. The algorithm is well-documented and handles edge cases like empty strings and emoji.
Provides a UIView subclass that manages multiple CAEmitterLayer instances for particle effects. It includes an LTEmitter struct that encapsulates emitter configuration (birth rate, velocity, lifetime, etc.) and exposes play/stop/update methods. The view allows creating named emitters with custom particle images and configure closures. This pattern is reusable for any iOS particle system, though it currently has a minor dependency on LTMorphingLabel for bundle resource loading.