Use iOS (>=10.0) HapTic API easily with Swift.
- First, import
HapTic
import HapTic
- Make HapTic with type.
HapTic.make(.impact(.heavy))
It is simple, right?
There's three feedback types in iOS.
- Notification: (UINotificationFeedbackType)
- success
- warning
- error
- Impact: (UIImpactFeedbackStyle)
- light
- medium
- heavy
- Selection
This project includes HapTicButton
, subclass of UIButton
.
-
Initialize button with
feedbackType
let button = HapTicButton(feedbackType: .selection)
-
Or, set
feedbackType
after initialize the button.let button = HapTicButton() button.feedbackType = .selection
-
Install with Cocoapods
pod 'HapTic', '~> 1.0'
- iOS >= 10.0
- But, feel free to use
HapTic
andHapTicButton
under iOS 10.0. The codes to handle exceptions under iOS10 are included.
- But, feel free to use
Run Demo on your iPhone. (It is so bad that cannot feel HapTic with iOS Simulator)
I'm a Swift-learner. If some bad codes are included in this project, PLEASE contribute with Pull request.
HapTic is written by Taejun Kim (KimDarren).
HapTic is under MIT license. See the LICENSE for more info.