I have an attribute modificationDate
in my Entity A.
I want to set its value whenever NSManagedObject
is saved. However, if i try to d
Swift 4 solution which is a combination of zmit and Richard answer without the need of recurring to NSNotification
:
override func willSave() {
let expectedNewValue = "Your new value"
if customField != expectedNewValue, changedValues()[#keyPath(Entity.customField)] == nil, !isDeleted {
customField = expectedNewValue
}
super.willSave()
}