Simplify the integration of haptic feedback in your SwiftUI applications with HapticEase. Trigger various haptic feedback types and custom patterns effortlessly.
HapticEase is a lightweight Swift library designed to simplify the integration of haptic feedback in your SwiftUI applications. Whether you’re looking to add a simple vibration or a complex pattern, HapticEase provides an easy-to-use interface to enhance your app’s user experience with tactile feedback.
Swift Package Manager
To integrate HapticEase into your project using Swift Package Manager, add it to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/emreeilhan/HapticEase.git", from: "1.0.0")
]
Alternatively, you can add the package directly within Xcode by going to:
File > Swift Packages > Add Package Dependency… and enter the repository URL:
https://github.com/emreeilhan/HapticEase.git
Basic Haptic Feedback
To use basic haptic feedback, create an instance of HapticFeedback
and call the desired method:
import HapticEase
let haptic = HapticFeedback()
haptic.success() // Triggers a success haptic feedback
Custom Haptic Patterns
HapticEase also allows you to create custom haptic patterns:
let haptic = HapticFeedback()
haptic.customLightPattern() // Triggers a custom light pattern
Integrating with SwiftUI
You can use HapticFeedbackModifier
to easily integrate haptic feedback into any SwiftUI view:
import SwiftUI
import HapticEase
struct ContentView: View {
@State private var triggerHaptic = false
var body: some View {
Button("Trigger Success Haptic") {
triggerHaptic.toggle()
}
.hapticFeedback(trigger: triggerHaptic, type: .success)
}
}
Comprehensive Documentation
HapticEase provides detailed documentation covering all aspects of its usage. You can find in-depth examples, API references, and tutorials on how to get the most out of HapticEase in your SwiftUI applications.
Visit the HapticEase Documentation to explore more.
Contributions are welcome! If you’d like to contribute, please fork the repository and use a feature branch. Pull requests should be made against the main
branch.
git checkout -b feature/AmazingFeature
git commit -m 'Add some AmazingFeature'
git push origin feature/AmazingFeature
HapticEase is licensed under the MIT License. For more details, please see the LICENSE file in the repository.