I have an array of objects Transaction
var returnedArray: Array<Transaction> = [a, b, c, d]
One of the properties Transactionis NSDate. I want to convert my array to a dictionary
var transactions: [NSDate: Array<Transaction>]
If all transactions on this date will be in the array with the date as the key.
I know how to iterate over each element of my array and manually assign it to the right key, but I wonder if there is an elegant function for this.
source
share