I have a question regarding Realm on iOS.
I have an object in my Realm DB that looks like this:
class MyObject: Object {
dynamic var id: Int!
dynamic var val: String!
}
Let say I populate my table with those data:
| id | val |
|----|-----|
| 1 | A |
| 2 | B |
| 3 | A |
| 4 | B |
| 5 | A |
| 6 | A |
How can query my Realm DB to return the most represented value which is A?
Thanks
Realm doesn't have a native query that'll do exactly that, but you can combine Realm's KVC support with NSCountedSet to get this fairly easily: