Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dm-zharov committed Apr 3, 2024
1 parent bedfd48 commit 6aebb86
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ Backport of SwiftUI Sensory Feedback API (iOS 17).
.hapticFeedback(.selection, trigger: value)
```

Directly play Haptic Feedback on iOS, macOS, watchOS.
Directly play Haptic Feedback.

```swift
// Style is similar to `NSHapticFeedbackManager & NSHapticFeedbackPerformer` (macOS API)
let feedbackPerformer = HapticFeedbackManager.defaultPerformer
feedbackPerformer.perform(.selection)
feedbackPerformer.perform(.levelChange)
feedbackPerformer.perform(.impact(weight: .heavy, intensity: 0.5))
...
// Determines if device supports haptic feedback
HapticFeedback.isAvailable

// Plays selection feedback
HapticFeedback.selection.play()

// Plays impact feedback
HapticFeedback.impact(weight: .heavy, intensity: 0.5).play()
```

## Installation
Expand Down

0 comments on commit 6aebb86

Please sign in to comment.