HapticEase
Simplify the integration of haptic feedback in your SwiftUI applications with HapticEase. Trigger various haptic feedback types and custom patterns effortlessly.
Install / Use
/learn @emreeilhan/HapticEaseREADME
HapticEase
HapticEase is a lightweight Swift library that simplifies 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.
Features
- Simple Integration: Easily add haptic feedback to any SwiftUI view with minimal code.
- Custom Patterns: Create and trigger custom haptic feedback patterns.
- Multiple Feedback Types: Includes support for light, medium, heavy impacts, and success, error, warning notifications.
Requirements
- iOS 13.0+
- Xcode 11.0+
- Swift 5.5+
Installation
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")
]
Or, 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
Usage
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)
}
}
Documentation
Comprehensive documentation is available here.
Contributing
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.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a pull request.
License
HapticEase is available under the MIT license. See the LICENSE file for more information.
Related Skills
node-connect
354.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
