📜  从子控制器 swift 5 更新父 vc - Swift 代码示例

📅  最后修改于: 2022-03-11 15:00:59.944000             🧑  作者: Mango

代码示例2
let nc = NSNotificationCenter.defaultCenter()
nc.addObserver(self, selector: #selector(printValue), name: "printValue", object: nil)

func printValue(notification:NSNotification) {
    let userInfo:Dictionary = notification.userInfo as! Dictionary
    let item = userInfo["value"]! as String

    print(item,self)
}