For arrays we could just do
resultArray = array1 + array2
I have two results of Results<(Object)> how do I add them?
Do I have to loop or is there in any other way?
RLMResults
are like array but not array, so you cannot add them directly, you have to use predicates to get your results. This is mentioned in Realm Doc
RLMResults is an auto-updating container type in Realm returned from object queries.
RLMResults can be queried with the same predicates as RLMObject and RLMArray and you can chain queries to further filter query results.
RLMResults cannot be created directly.
But If you want to add objects of RLMArray
or RLMResults
in an existing RLMArray
you can use – addObjects:
method of RLMArray
only condition is that both the results should be of the same class. RLMArray Doc for reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With