假设这个观察者在应用程序启动时创建
ref.observe(.value, with: { (snapshot) in
// do something
})
幕后发生了什么?应用程序如何知道值何时更改?我所能想象的只有这个
while (true) {
ref.observeSingleEvent(of: .value, with: { (snapshot) in
// if value is different do something
})
}