Lets say I have two Entitys. Item: name (to-many-Attribute)
Attribute: income: (to-one-Item)
Firstly, I follow this answer to get the sum.
let totalIncome = item.value(forKeyPath: "attribute.@sum.income")
But totalIncome I get is Any type, not Int as the income. How to make it work?

Secondly, if I get the count number of the incomes, how to write the code?
Thanks for any help!