You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UserInfo.hairColor.bindAndFireListener("ThirdViewController.backgroundColor") { [weak self = self] color in
if let viewController = self {
viewController.view.backgroundColor = color
}
}
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)
}
}
不过 我感觉还需要完善 比如当 ViewController 销毁了 应该把事件移出
感觉 还是 NSNotificationCenter 方便 哈哈~
The text was updated successfully, but these errors were encountered: