From 6e6a357064b1bd19352fd11247d5efdb10394ed1 Mon Sep 17 00:00:00 2001 From: Kieran Brown Date: Fri, 1 May 2020 18:05:26 -0400 Subject: [PATCH] Updated UIFeedback generators for macOS --- Sources/Sliders/Joystick.swift | 6 ++++++ Sources/Sliders/LSlider.swift | 3 +++ Sources/Sliders/TrackPad.swift | 3 +++ 3 files changed, 12 insertions(+) diff --git a/Sources/Sliders/Joystick.swift b/Sources/Sliders/Joystick.swift index 1aa61a2..19b853d 100644 --- a/Sources/Sliders/Joystick.swift +++ b/Sources/Sliders/Joystick.swift @@ -353,12 +353,18 @@ public struct Joystick: View { // MARK: Haptics private func impactOccured() { + #if os(macOS) + #else let generator = UIImpactFeedbackGenerator(style: .medium) generator.impactOccurred() + #endif } private func locked() { + #if os(macOS) + #else let generator = UINotificationFeedbackGenerator() generator.notificationOccurred(.success) + #endif } private func enteredLockBoxHandler(_ isInside: Bool) { if self.canLock { diff --git a/Sources/Sliders/LSlider.swift b/Sources/Sliders/LSlider.swift index 117c3f8..a208b20 100644 --- a/Sources/Sliders/LSlider.swift +++ b/Sources/Sliders/LSlider.swift @@ -224,8 +224,11 @@ public struct LSlider: View { // MARK: Haptics private func impactOccured() { + #if os(macOS) + #else let generator = UIImpactFeedbackGenerator(style: .medium) generator.impactOccurred() + #endif } private func impactHandler(_ parameterAtLimit: Bool) { if parameterAtLimit { diff --git a/Sources/Sliders/TrackPad.swift b/Sources/Sliders/TrackPad.swift index f176042..13a5188 100644 --- a/Sources/Sliders/TrackPad.swift +++ b/Sources/Sliders/TrackPad.swift @@ -244,8 +244,11 @@ public struct TrackPad: View { // MARK: Haptics private func impactOccured() { + #if os(macOS) + #else let generator = UIImpactFeedbackGenerator(style: .medium) generator.impactOccurred() + #endif } // MARK: View public var body: some View {