ios - RLMObjects not recognised as the same in Realm Cocoa -


i have tableview containing rlmobjects , want search row containing specific rlmobject. after casting rlmresult object original type not same original object:

    // ... adding todoa !iscompleted defaultrealm()     var firstitem = todo.objectswhere("iscompleted == false")[0] as! todo     if firstitem == todoa {          // todoa != firstitem even-though should same object     } 

how can compare 2 rlmobjects without having implement primarykey allocation?

rlmobject not conform swift's equatable protocol, allowing == , != comparisons. depending on equality semantics want objects, can use following extension on rlmobject:

extension rlmobject: equatable {} func == <t: rlmobject>(lhs: t, rhs: t) -> bool {   return lhs.isequaltoobject(rhs) } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -