Combine lists of embedded objects

I’m using Realm Swift and have lists of embedded objects that I want to combine and sort.

Specifically, I have an embedded object called Hunter in a scavenger hunt app.

At least one Hunter is hosting the scavenger hunt, so they are in a hunt.hosts list. (other hunters can be added as hosts as well, the reason this is a list).

There is also a list of type Hunter in a hunt.hunters list.

I’d like to show a list sorted by score that includes both. Kind of like:

[hunt.hosts, hunt.hunters].sorted("score", ascending: true)

I could do this by mapping all of the objects into a new array, but then I lose the live updates. Is there a way to combine multiple lists of the same type of EmbeddedObjects?

If not, I can rethink my structure, but it would be awesome if this was possible.

Thanks.

–Kurt

Well, I didn’t get any hits on here so I went another route.

If there is a way to do this, I would love to know.

But what I did was change the way that the embedded object model was set up.

I added a type property with a RealmEnum and then just put them all in one list with different types that can be filtered in queries to show the right lists of hunters. This way I can omit the queries if I want them all in one list rather than attempting to combine them later.

–Kurt