With this code I create the array
struct Item {
let expense : String
let year : String
let value : Float
}
var resultArray = [Item]()
resultArray.append(Item(expense: "Restaurant", year: "2019", value: 1000))
resultArray.append(Item(expense: "Restaurant", year: "2020", value: 500))
resultArray.append(Item(expense: "Restaurant", year: "2021", value: 100))
resultArray.append(Item(expense: "Gym", year: "2019", value: 100))
resultArray.append(Item(expense: "Gym", year: "2020", value: 100))
resultArray.append(Item(expense: "Gas", year: "2020", value: 200))
resultArray.append(Item(expense: "Gas", year: "2021", value: 50))
If I were to represent the result in the form of an excel table, I would get this
I would like obtain this, but I don't know how:
Thank you
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…