iosobjective-crealmrealm-cocoa

removeObjects from RLMResults


How can I remove objects from RLMResults. I mean in NSMutableArray there is a function like

[self.dogs removeAllObjects]

is there any funcation like that for RLMResults or RLMArray?


Solution

  • Such a method exists for RLMArray with removeAllObjects. This means that you disassociate the object from all other linked objects within the array.

    There is no such method for RLMResults, because instances of this class represent always the latest state of your query, which you can only mutate if you modify your underlying data. So if you query on a list, this would be implicitly possible by removing objects from the list. If you query on all objects (/ a table), then you would need either delete the objects from the Realm or modify them in such a way that they don't match your query anymore.