Swiftpack.co - Jnis/SwiftUIRippleEffect as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Jnis.
Jnis/SwiftUIRippleEffect 1.0.0
Ripple effect on SwiftUI
⭐️ 1
🕓 1 week ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/Jnis/SwiftUIRippleEffect.git", from: "1.0.0")

SwiftUIRippleEffect

Cool ripple effect on you SwiftUI view.

Features

  • easy to use for regular button
  • long press and gesture support

Installing

Swift Package Manager:

https://github.com/Jnis/SwiftUIRippleEffect.git

Usage

  1. Make a shared RippleViewModel
  2. Add touch handler by .addRippleTouchHandler method
  3. Add ripple view by .addRipple method
import SwiftUIRippleEffect

var button1: some View {
    VStack {
        let rippleViewModel = RippleViewModel() // 1
        Button(action: {
            
        }, label: {
            HStack {
                Spacer()
                Text("Title 1").padding()
                Spacer()
            }
            .addRippleTouchHandler(viewModel: rippleViewModel) // 2
        })
        .buttonStyle(EmptyStyle())
        .background(
            Capsule()
                .foregroundColor(.yellow)
                .addRipple(color: .gray,
                           rippleViewModel: rippleViewModel,
                           clipShape: Capsule()) // 3
        )
    }.padding()
}

You can find more examples inside /Examples folder.

License

MIT

GitHub

link
Stars: 1
Last commit: 4 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Dependencies

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics