0

When instantiating 'UINotificationFeedbackGenerator' for haptic feedback, I get this compiler error:

Use of unresolved identifier 'UINotificationFeedbackGenerator'

This is how I instantiate it:

   let hapticNotificationFeedback = UINotificationFeedbackGenerator()
   hapticNotificationFeedback?.prepare()
   var hapticImpactFeedback = UIImpactFeedbackGenerator(style: .medium)

I am instantiating this in a view controller extension in a separate file.

craft
  • 2,017
  • 1
  • 21
  • 30

1 Answers1

1

Since it's a view controller class extension file, you need to import UIKit in this file as well

import UIKit

craft
  • 2,017
  • 1
  • 21
  • 30