CloudKit Query with count and group By

What would be the correct method to implement a


SELECT keyField , count(*) FROM table GROUP BY keyField;


should return


keyFieldA 3

keyFieldB 5

keyFieldC 6

....


Trying to structure the query using CloudKit CKQuery and swift



Thanks in advance

Did you ever find a workaround for this? I assume the query itself couldn't satisfy the requirement, but that slightly less robust alternatives might be crafted using custom records for counting...

This would really help me.

CloudKit Query with count and group By
 
 
Q