Я создаю приложение чата с socket.io, но не могу обработать уведомление о вводе имени пользователя. Не знаю, где я делаю неправильно. Я показываю свой код
Код:
отсюда я отправляю уведомление
func listenForOtherMessages() {
socket.on("userTypingUpdate") { (dataArray, socketAck) -> Void in
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "userTypingNotification"), object: dataArray[0] as? [String: AnyObject])
}
}
отсюда я передаю свое уведомление
@objc func handleKeyboardDidShowNotification(notification: NSNotification) {
if let userInfo = notification.userInfo {
if let keyboardFrame = (userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue {
conBottomEditor.constant = keyboardFrame.size.height
view.layoutIfNeeded()
}
}
}
и в последний раз я помещаю свой селектор, но мое уведомление успешно отправлено, но я все же получил
let notificationCenter4 = NotificationCenter.default
notificationCenter4.addObserver(self, selector: #selector(handleKeyboardDidShowNotification(notification:)), name:NSNotification.Name(rawValue: "userTypingNotification"), object: nil)