A simple Ripple animation view in SwiftUI.
solid | outlined |
---|---|
Here is how to integrate the library into your iOS project.
- File > Swift Packages > Add Package Dependency
- Add
https://github.com/emmanuelkehinde/RippleView.git
- Select "Up to Next Major Version" with "1.0.2"
Place the RippleView
anywhere you want it to appear in your SwiftUI View.
ZStack {
RippleView()
}
You also have access to some customization options.
@State private var rippleShouldAnimate: Bool = true
ZStack {
RippleView(
style: .solid,
rippleCount: 7,
tintColor: Color.blue,
timeIntervalBetweenRipples: 0.18,
shouldAnimate: $rippleShouldAnimate
)
}
Available parameters include:
- style: The ripple style, either
solid
oroutlined
, defaults tosolid
- rippleCount: The number of ripples to display, defaults to
5
- tintColor: The color to tint the ripples with, defaults to
black
- timeIntervalBetweenRipples: The expected time interval between each ripple display, defaults to
0.13
- shouldAnimate: A binding that tells if animation should begin or not, defaults to
true
https://emmanuelkehinde.io/swiftui-building-a-reusable-ripple-animation-view-swift-package/
Enjoy 🚀