Post

Replies

Boosts

Views

Activity

Reply to How to sum the same category total in SwiftUI?
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          }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’22
Reply to How to make sound effects in spinning wheel?
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)                } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to How to sum the same category total in SwiftUI?
I got exactly what I need like below:
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to How to sum the same category total in SwiftUI?
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          }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to How to sum the same category total in SwiftUI?
In the view i want to get the only one category with total amount like: Hotel : $610/ Not like the pic above :
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to How to make sound effects in spinning wheel?
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)                } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to How to get index in an array from an random rotation degrees?
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
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21