-
Notifications
You must be signed in to change notification settings - Fork 706
Open
Description
hello 看了https://github.com/nixzhu/dev-blog/blob/master/2015-04-30-property-listener.md 发现 vc 没有被释放
加上个了 引用列表 如下
UserInfo.name.bindAndFireListener("ThirdViewController.nameButton") { [weak self = self] name in
if let viewController = self {
viewController.nameButton.setTitle(name, forState: .Normal)
}
}
UserInfo.hairColor.bindAndFireListener("ThirdViewController.backgroundColor") { [weak self = self] color in
if let viewController = self {
viewController.view.backgroundColor = color
}
}
不过 我感觉还需要完善 比如当 ViewController 销毁了 应该把事件移出
感觉 还是 NSNotificationCenter 方便 哈哈~
Metadata
Metadata
Assignees
Labels
No labels