commit 52494d6349340e56b0e259d91be37c815c32f6b5 parent eb9f01ffd059c91e2b3ce4e2443c38c52f53aa32 Author: Marc Stibane <marc@taler.net> Date: Wed, 3 Jan 2024 17:39:54 +0100 hapticFeedback Diffstat:
| M | TalerWallet1/Helper/Controller+playSound.swift | | | 13 | +++++++++++++ |
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/TalerWallet1/Helper/Controller+playSound.swift b/TalerWallet1/Helper/Controller+playSound.swift @@ -11,15 +11,28 @@ extension Controller { @MainActor func hapticNotification(_ feedbackType: UINotificationFeedbackGenerator.FeedbackType) { if useHaptics { + /// call when a notification is displayed, passing the corresponding type UINotificationFeedbackGenerator().notificationOccurred(feedbackType) } } @MainActor func hapticFeedback(_ feedbackStyle: UIImpactFeedbackGenerator.FeedbackStyle) { + /// call when your UI element impacts something else UIImpactFeedbackGenerator(style: feedbackStyle).impactOccurred() } + @MainActor + func hapticFeedback(intensity: CGFloat) { + /// call when your UI element impacts something else with a specific intensity [0.0, 1.0] + UIImpactFeedbackGenerator().impactOccurred(intensity: intensity) + } + + @MainActor + func hapticFeedback() { + /// call when the selection changes (not on initial selection) + UISelectionFeedbackGenerator().selectionChanged() + } /// 0 = failure, 1 = received, 2 = sent @MainActor func playSound(_ number: Int) {