Inscrutable Swift compiler error when comparing two object arrays -


i'm trying compare 2 object arrays this:

if oneobjectarray != anotherobjectarray {    // ... stuff } 

however following less helpful compiler error:

binary operator '!=' cannot applied operands of type '[mymodelobject]' , '[(mymodelobject)]'`

the compiler error points first operand in equality check.

i think problem have not made myobectmodel equatable.

in order check equality of 2 arrays of myobjectmodel need able check equality of 2 myobjectmodel objects.

to need following...

extension myobjectmodel: equatable {}  // top level function func ==(lhs: myobjectmodel, rhs: myobjectmodel) -> bool {     // check if objects equal here...     return lhs.name == rhs.name } 

Comments

Popular posts from this blog

Upgrade php version of xampp not success -

amazon web services - S3 and apache mod_proxy with basic authentication -

powershell - This solution contains one or more assemblies targeted for the global assembly cache -