SwiftUI: UIFeedbackGenerator is not working on iPhone6s

277 views Asked by At

I have the file described bellow to enable haptic feedback in SwiftUI. This functionality works fine on devices like the iPhone 11 Pro Max, 12 Pro Max, and iPhone 8 but strangely just not on the iPhone 6s. Does anyone know why? Note: Yes, the iPhone 6s usually supports haptic feedback. Warm greetings

Haptic feedback manager:

struct HapticFeedbackManager {
    
    static let shared = HapticFeedbackManager()
    
    let impactGenerator = UIImpactFeedbackGenerator()
    
    // Für das verschieben von Zellen
    let selectionFeedback = UISelectionFeedbackGenerator()
    
    // Erfolg, Warnung und Fehlschlag
    let notificationFeedback = UINotificationFeedbackGenerator()

    
    private init() {}
    
    
    func generateImpactFeedback(intensity: CGFloat) {
        impactGenerator.impactOccurred(intensity: intensity)
        print("Impact Feedback wurde generiert")
    }
    
    func generateSelectionFeedback() {
        selectionFeedback.selectionChanged()
        print("Selection Feedback wurde generiert")
    }
    
    func generateSuccessFeedback() {
        notificationFeedback.notificationOccurred(.success)
        print("Erfolg Feedback wurde generiert")
    }
    
    func generateWarningFeedback() {
        notificationFeedback.notificationOccurred(.warning)
        print("Warning Feedback wurde generiert")
    }
    
    func generateErrorFeedback() {
        notificationFeedback.notificationOccurred(.error)
        print("Error Feedback wurde generiert")
    }
}
0

There are 0 answers