This question is marked as off-topic because it contains API not related to the open source project itself.
I cannot look up the API atm. but judging from what it does, your logic has some issues. The propery returns an [Int] which means that 0 to n cells are selected. You should iterate over the array and decide what to do with each index.
Other than that stdlib has a reduce function to merge each value of the array to a result type.