Swift Notification使用
简单使用记录
//注册监听
var observer = NotificationCenter.default.addObserver(forName: Notification.Name(rawValue: "Notify"), object: nil, queue: OperationQueue.main) {_ in
}
//移除监听
NotificationCenter.default.removeObserver(observer)
//发送通知
NotificationCenter.default.post(name: Notification.Name("Notify"), object: nil)