Comparing Object properties

22 Views Asked by At

I'm trying to compare two objects to check which properties were updated. I'm using Mirror to list the properties and try the comparison. Code is:

let mirrorLote = Mirror(reflecting: l)
let mirrorLoteUpd = Mirror(reflecting: lUpd)

mirrorLote.children.forEach { child in
    if (child.label != "id") {
        mirrorLoteUpd.children.forEach { childUpd in
            if (child.label == childUpd.label && child.value != childUpd.value){
                addUpdatesDB(prop: child.label, val: childUpd.value)
            }
        }
    }
}

I'm getting the following error:

Type 'Any' cannot conform to 'RawRepresentable'

when trying to compare the values (child.value != childUpd.value).

Any ideas on how can I resolve this?

0

There are 0 best solutions below