A UISwitch subclass that animates its superview's background color when toggled, with customizable animations for other UI elements.
ViralSwitch is an open-source iOS library that extends UISwitch to create a viral color-spread animation across its parent view when toggled. It solves the need for more engaging and visually distinctive toggle controls in iOS apps by providing customizable animations that enhance user feedback.
iOS developers looking to add polished, animated toggle switches to their apps without building custom animation logic from scratch.
Developers choose ViralSwitch for its drop-in simplicity, extensive customization options for synchronized animations, and the ability to create visually striking interactions that go beyond standard UISwitch behavior.
A UISwitch that infects its superview with its tint color.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically spreads the onTintColor to the parent view's background, creating immediate visual feedback when toggled, as demonstrated in the README's gif and description.
Allows customization via animationDuration property and completion blocks (completionOn/completionOff), enabling fine-tuned timing and post-animation actions.
Supports animating other UI elements like labels and buttons using animationElements arrays, coordinating color changes across the interface with CoreAnimation key paths.
Can be used directly in place of standard UISwitch with minimal code changes, easing integration into existing UIKit projects without overhauling toggle logic.
Setting up animations for multiple views requires complex dictionary syntax with AMElementView and AMElementKeyPath, which is error-prone and cumbersome compared to modern Swift APIs.
Lacks SwiftUI support, forcing developers to use UIViewRepresentable wrappers for integration, which adds complexity and doesn't leverage SwiftUI's native animation system.
Adding multiple CoreAnimation layers and synchronizing animations might impact performance on older devices or in view-heavy apps, as noted in the reliance on CoreAnimation properties.