Simply detect shake gestures in SwiftUI.
This component is distributed as a Swift package.
struct ShakeTest: View {
@State private var text = "Shake me!"
var body: some View {
Text(text)
.onShake { // ADD THIS
text = "Shaken at \(Date())"
}
}
}
Check out this recipe for in-depth description of the component and its code. Check out SwiftUIRecipes.com for more SwiftUI recipes!
link |
Stars: 11 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics