通知的使用
//通知名称常量
let NotifyChatMsgRecv = NSNotification.Name(rawValue:"notifyChatMsgRecv")
//发送通知NotificationCenter.default.post(name:NSNotification.Name(rawValue:"notifyChatMsgRecv"), object: nil, userInfo: nil)
//接受通知监听
NotificationCenter.default.addObserver(self, selector:#selector(didMsgRecv(notification:)), name: NotifyChatMsgRecv, object: nil)
//通知处理函数
func didMsgRecv(notification:NSNotification){
print("didMsgRecv: \(notification.userInfo)")
}