How to use objectWillChange in Combine

Issue #513

A publisher that emits before the object has changed

Use workaround DispatchQueue to wait another run loop to access newValue

1
2
3
4
5
6
7
8
9
.onReceive(store.objectWillChange, perform: {
DispatchQueue.main.async {
self.reload()
}
})

func reload() {
self.isFavorite = store.isFavorite(country: country)
}

Read more

Comments