I got exactly what I need like below:
Post
Replies
Boosts
Views
Activity
Thank you sir, i tried it again but i got this error like below:
let newArray = expensesData.filter {format(date: $0.date) == format(date: self.currentDate)}
let expenseArray = newArray.filter {$0.type == "Expense"}
// self.sortedByExpense = expenseArray.sorted(by: {$0.amount > $1.amount})
var icons: [String] = []
for i in expenseArray {
icons.append(i.expenseIcon)
}
print(icons)
var sums: [String] = []
for i in icons {
sums[i] = expenseArray.filter{$0.expenseIcon == i}.reduce(0){sum, item in sum + item.amount}
//No 'reduce' candidates produce the expected contextual result type 'String'
//No exact matches in call to subscript
}
In the view i want to get the only one category with total amount like: Hotel : $610/ Not like the pic above :
Hey @Claude31 I have no idea how to get typical spinning parameters :(
.onTapGesture {
withAnimation(Animation.timingCurve(0.0, 0.8, 0.2, 1.0, duration: 10)) {
self.chanceVM.rotateDegree = Double.random(in: 5400.0...7200.0)
} }
I think i figured it out, i use : Text(chanceVM.newChoices[chanceVM.newChoices.count - (Int(chanceVM.rotateDegree) % 360)/(360/chanceVM.newChoices.count) - 1]) I don't know why i just use mius 1 then i get the result