- April 27, 2024
- Mins Read
Haptica is an easy haptic feedback generator.
$ pod try Haptica
Generate using a haptic feedback type.
Haptic.impact(.light).generate()
Play a custom vibration pattern:
Haptic.play(“..oO-Oo..”, delay: 0.1)
Use pattern symbols to represent custom vibrations.
O
– heavy impacto
– medium impact.
– light impactX
– rigid impactx
– soft impact-
– wait 0.1 secondOr play a symphony of notes:
Haptic.play([.haptic(.impact(.light)), .haptic(.impact(.heavy)), .wait(0.1), .haptic(.impact(.heavy)), .haptic(.impact(.light))])
To enable haptic feedback on buttons, set these properties:
isHaptic
– enables haptic feedbackhapticType
– haptic feedback type
button.isHaptic = true
button.hapticType = .impact(.light)
or use these functions to set the haptic feedback type for control events:
addHaptic()
– add haptic feedback for control eventsremoveHaptic()
– remove haptic feedback for control events
button.addHaptic(.selection, forControlEvents: .touchDown)
button.removeHaptic(forControlEvents: .touchDown)
var isHaptic: Bool // enables haptic feedback
var hapticType: Haptic? // haptic feedback type
var hapticControlEvents: UIControl.Event? // haptic feedback control events
func addHaptic(_ haptic: Haptic, forControlEvents events: UIControl.Event) {} // add haptic feedback for control events
func removeHaptic(forControlEvents events: UIControl.Event) {} // remove haptic feedback for control events
Add sound effects to Haptica using Peep.
Peep.play(sound: KeyPress.tap)
To install with CocoaPods, simply add this in your Podfile
:
use_frameworks!
pod “Haptica”
To install with Carthage, simply add this in your Cartfile
:
github “efremidze/Haptica”
Horizon SDK is a state of the art real-time video recording / photo shooting iOS library. Some of the features ...