Haptico provides built-in UI components and extensions to simplify haptic integration in your interface:
HapticoButton
HapticoButton is a subclass of UIButton. To use it:
- Set the class name to
HapticoButton in your Storyboard. - It automatically triggers haptics based on touch events:
UIControlEvents.touchDown: Triggers a heavy impact.UIControlEvents.touchUpInside or touchUpOutside: Triggers a light impact.
UIAlertController Extension
You can trigger haptic notifications directly when presenting a UIAlertController using the hapticNotification parameter.
import UIKit
import Haptico
func showSuccessAlert() {
let alert = UIAlertController(title: "Alert Title", message: "Alert Message", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
// Triggers a success haptic notification upon presentation
present(alert, animated: true, hapticNotification: .success)
}