Skip to content

Commit

Permalink
Updated UIFeedback generators for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
kieranb662 committed May 1, 2020
1 parent 71dffcc commit 6e6a357
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/Sliders/Joystick.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Sliders/LSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Sliders/TrackPad.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6e6a357

Please sign in to comment.