我可以做些什么来监视嵌入式子 Controller 变量或 Realm 的变化,以快速更新父 View Controller 中的图标?
最佳答案
尝试使用Realm Notifications当 Realm 发生任何更改时更新您的父 Controller :
// Observe Realm Notifications
let token = realm.addNotificationBlock { notification, realm in
viewController.updateUI()
}
关于swift - RealmSwift 在 Realm 计数发生变化时执行某些操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34184765/