Type 'NSNotification.Name' has no member 'UITextField'

I faced the same problem,

Here is the simplest solution:

Instead of using forName: NSNotification.Name.UITextField.textDidChangeNotification

Use like this in forName: Parameter:

NotificationCenter.default.addObserver(forName: UITextField.textDidChangeNotification, object: textField, queue: OperationQueue.main) { (notification) in
//Your code goes here...
        }

        NotificationCenter.default.addObserver(forName: Notification.Name.UITextFieldTextDidChange, object: textField, queue: OperationQueue.main) { (notification) in
            //...
    }

In swift sdk, All notification name should be the extension of struct: Notification.Name

So when use Notification.Name, you should ignore Class name(exc.UITextField), input "Notification.Name." then input some of your name(like "TextF") and use esc to show autocomplete


textDidChangeNotification is a member of UITextField (and UITextView).

NotificationCenter.default.addObserver(
    self,
    selector: #selector(self.keyboardDidShow(notification:)),
    name: UITextField.textDidChangeNotification,
    object: nil)