Swiftpack.co - globulus/swiftui-shake-gesture as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by globulus.
globulus/swiftui-shake-gesture 1.0.0
Detect shake gesture in SwiftUI!
⭐️ 11
🕓 2 years ago
iOS
.package(url: "https://github.com/globulus/swiftui-shake-gesture.git", from: "1.0.0")

SwiftUIShakeGesture

Simply detect shake gestures in SwiftUI.

Preview

Installation

This component is distributed as a Swift package.

Sample usage

struct ShakeTest: View {
  @State private var text = "Shake me!"
    
  var body: some View {
    Text(text)
      .onShake { // ADD THIS
        text = "Shaken at \(Date())"
      }
  }
}

Recipe

Check out this recipe for in-depth description of the component and its code. Check out SwiftUIRecipes.com for more SwiftUI recipes!

GitHub

link
Stars: 11
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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