https://github.com/WorldDownTown/TapticEngine
TapticEngine generates haptic feedback vibrations on iOS device.
https://github.com/WorldDownTown/TapticEngine
ios swift uifeedbackgenerator
Last synced: 8 months ago
JSON representation
TapticEngine generates haptic feedback vibrations on iOS device.
- Host: GitHub
- URL: https://github.com/WorldDownTown/TapticEngine
- Owner: WorldDownTown
- License: mit
- Created: 2017-04-09T13:29:09.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-19T10:43:43.000Z (about 7 years ago)
- Last Synced: 2024-11-14T01:18:54.214Z (over 1 year ago)
- Topics: ios, swift, uifeedbackgenerator
- Language: Swift
- Homepage:
- Size: 67.4 KB
- Stars: 260
- Watchers: 7
- Forks: 20
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - TapticEngine - TapticEngine generates iOS Device vibrations. (Hardware / Other Hardware)
- awesome-ios-star - TapticEngine - TapticEngine generates iOS Device vibrations. (Hardware / Other Hardware)
- fucking-awesome-ios - TapticEngine - TapticEngine generates iOS Device vibrations. (Hardware / Other Hardware)
README
# TapticEngine
[](https://doge.mit-license.org)
[](https://developer.apple.com/swift)
[](https://github.com/Carthage/Carthage)
[](http://cocoadocs.org/docsets/TapticEngine/)
[](http://cocoadocs.org/docsets/TapticEngine/)
[](https://github.com/matteocrippa/awesome-swift#haptic-feedback)
## Overview
TapticEngine generates haptic feedback vibrations on iOS device.
This library wrapps on [UIImpactFeedbackGenerator](https://developer.apple.com/reference/uikit/uiimpactfeedbackgenerator), [UISelectionFeedbackGenerator](https://developer.apple.com/reference/uikit/uiselectionfeedbackgenerator), [UINotificationFeedbackGenerator](https://developer.apple.com/reference/uikit/uinotificationfeedbackgenerator).

## Demo
Build Xcode project.
1. Open TapticEngine.xcodeproj.
2. Change Scheme to `TapticEngineDemo`
3. Run
## Usage
```swift
// Triggers an impact feedback between small, light user interface elements. (`UIImpactFeedbackStyle.light`)
TapticEngine.impact.feedback(.light)
// Triggers an impact feedback between moderately sized user interface elements. (`UIImpactFeedbackStyle.medium`)
TapticEngine.impact.feedback(.medium)
// Triggers an impact feedback between large, heavy user interface elements. (`UIImpactFeedbackStyle.heavy`)
TapticEngine.impact.feedback(.heavy)
// Triggers a selection feedback to communicate movement through a series of discrete values.
TapticEngine.selection.feedback()
// Triggers a notification feedback, indicating that a task has completed successfully. (`UINotificationFeedbackType.success`)
TapticEngine.notification.feedback(.success)
// Triggers a notification feedback, indicating that a task has produced a warning. (`UINotificationFeedbackType.warning`)
TapticEngine.notification.feedback(.warning)
// Triggers a notification feedback, indicating that a task has failed. (`UINotificationFeedbackType.error`)
TapticEngine.notification.feedback(.error)
// Prepare an impact feedback for `UIImpactFeedbackStyle.light`.
TapticEngine.impact.prepare(.light)
// Prepare a selection feedback.
TapticEngine.selection.prepare()
// Prepare a notification feedback.
TapticEngine.notification.prepare()
```
## Requirements
- Swift 4.0+
- iOS 9.0+ (**But it works on iOS 10 or later. On iOS 9, it does nothing.**)
## Installation
### Carthage
TapticEngine is available through [Carthage](https://github.com/Carthage/Carthage). To install it, simply add the following line to your Cartfile:
```
github "WorldDownTown/TapticEngine"
```
### CocoaPods
TapticEngine is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:
```ruby
pod 'TapticEngine'
```
### Manually
Download and drop `TapticEngine/Sources` folder in your project.
## Author
WorldDownTown, WorldDownTown@gmail.com
## License
TapticEngine is available under the MIT license. See the LICENSE file for more info.