Skip to content

Haptics

Nick Sarno edited this page Apr 9, 2022 · 2 revisions

.withHaptic

Add Haptic support to a View.

Text("HELLO WORLD")
     .withHaptic(onChangeOf: Equatable)

Specify the vibration type if needed.

Text("HELLO WORLD")
     .withHaptic(option: .heavy, onChangeOf: Equatable)
public enum HapticOption: String, CaseIterable {
    case light
    case medium
    case heavy
    case success
    case error
    case warning
    case none
    case selection
}
Clone this wiki locally