Some checks failed
CI / test (push) Has been cancelled
Bring the SwiftUI app in line with the Apple-native mock and keep pending approvals actionable from Live Activities and watch complications.
34 lines
869 B
Swift
34 lines
869 B
Swift
import SwiftUI
|
|
|
|
#if os(iOS)
|
|
import UIKit
|
|
#elseif os(macOS)
|
|
import AppKit
|
|
#endif
|
|
|
|
enum Haptics {
|
|
static func success() {
|
|
#if os(iOS)
|
|
UINotificationFeedbackGenerator().notificationOccurred(.success)
|
|
#elseif os(macOS)
|
|
NSHapticFeedbackManager.defaultPerformer.perform(.levelChange, performanceTime: .now)
|
|
#endif
|
|
}
|
|
|
|
static func warning() {
|
|
#if os(iOS)
|
|
UINotificationFeedbackGenerator().notificationOccurred(.warning)
|
|
#elseif os(macOS)
|
|
NSHapticFeedbackManager.defaultPerformer.perform(.alignment, performanceTime: .now)
|
|
#endif
|
|
}
|
|
|
|
static func selection() {
|
|
#if os(iOS)
|
|
UISelectionFeedbackGenerator().selectionChanged()
|
|
#elseif os(macOS)
|
|
NSHapticFeedbackManager.defaultPerformer.perform(.alignment, performanceTime: .now)
|
|
#endif
|
|
}
|
|
}
|