Originally created by @itShouldWork on GitHub (Jul 13, 2020).
I have an object:
class Dialog: CoreStoreObject {
@Field.Relationship("messages", inverse: \.$dialog, deleteRule: .cascade)
var messages: Set<Message>
}
On some events one or many messages in dialog can be changed (message’s text etc).
I need to handle these changes via «objectMonitor» that observes the «Dialog» object, but the «didUpdateObject» method doesn’t call. As I suppose, because the «Dialog» object really hasn’t changes (there are changes only for messages). However, if I could get a notification about the change of the «Dialog» object through the "didUpdateObject" method, that would be great.
Do you have any idea how I can get this behaviour?
Thank you in advance!
Originally created by @itShouldWork on GitHub (Jul 13, 2020).
I have an object:
`class Dialog: CoreStoreObject {`
@Field.Relationship("messages", inverse: \.$dialog, deleteRule: .cascade)
var messages: Set<Message>
`}`
On some events one or many messages in dialog can be changed (message’s text etc).
I need to handle these changes via «**objectMonitor**» that observes the «**Dialog**» object, but the «**didUpdateObject**» method doesn’t call. As I suppose, because the «**Dialog**» object really hasn’t changes (there are changes only for messages). However, if I could get a notification about the change of the «**Dialog**» object through the "**didUpdateObject**" method, that would be great.
Do you have any idea how I can get this behaviour?
Thank you in advance!
adam
added the question label 2025-12-29 15:29:20 +01:00
Relationship properties do not notify any of the observers. This is the behavior inherited from Core Data.
If you need this functionality, create a property in the parent object that gets updated whenever the child object is updated.
In your case for example, you could have a Dialog.updatedDate property that can be updated whenever a reload is needed.
@JohnEstropia commented on GitHub (Jul 16, 2020):
Relationship properties do not notify any of the observers. This is the behavior inherited from Core Data.
If you need this functionality, create a property in the parent object that gets updated whenever the child object is updated.
In your case for example, you could have a `Dialog.updatedDate` property that can be updated whenever a reload is needed.
I would like to take this moment to express my deep gratitude for this framework!👏
@itShouldWork commented on GitHub (Jul 17, 2020):
Got it, thanks for the answer!
I would like to take this moment to express my deep gratitude for this framework!👏
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @itShouldWork on GitHub (Jul 13, 2020).
I have an object:
class Dialog: CoreStoreObject {}On some events one or many messages in dialog can be changed (message’s text etc).
I need to handle these changes via «objectMonitor» that observes the «Dialog» object, but the «didUpdateObject» method doesn’t call. As I suppose, because the «Dialog» object really hasn’t changes (there are changes only for messages). However, if I could get a notification about the change of the «Dialog» object through the "didUpdateObject" method, that would be great.
Do you have any idea how I can get this behaviour?
Thank you in advance!
@JohnEstropia commented on GitHub (Jul 16, 2020):
Relationship properties do not notify any of the observers. This is the behavior inherited from Core Data.
If you need this functionality, create a property in the parent object that gets updated whenever the child object is updated.
In your case for example, you could have a
Dialog.updatedDateproperty that can be updated whenever a reload is needed.@itShouldWork commented on GitHub (Jul 17, 2020):
Got it, thanks for the answer!
I would like to take this moment to express my deep gratitude for this framework!👏