I’ve a UIView with a listing of things. When one merchandise is deleted from the listing an total variable will probably be recalculated within the mannequin class, which is able to take a while as it’ll go over all information on all of the objects. So as to keep up a correspondence with the consumer I like to point out a progress bar, however for that I would like the share performed from the category to the UIView. I used to be not in a position to learn how to get the share in the course of the recalculation. I’d be very glad if one might level me to the fitting route:
my UIView shorted:
var physique: some View {
Record{
ForEach(handicapValues, id:.self) {handicapValue in
NavigationLink(worth:handicapValue,
label: {CellRoundView(handicapValue: handicapValue)})
.padding(.backside, 1)
.swipeActions(allowsFullSwipe: false) {
Button() {
itemToDelete = handicapValue
showingRecalc = true
} label: {
Label("Delete", systemImage: "trash.fill")
}
.tint(.crimson)
} // Finish of .swipeActions()
} // finish foreach
}.alert(isPresented: $showingRecalc) {
Alert(title: Textual content("Delete spherical ?"), message: Textual content("Handicaps will probably be recalculated"), primaryButton: .damaging(Textual content("Delete")) {
removeRound(hcValue: itemToDelete!)
PersistentController.shared.recalcHCvalues_test(rounds: rounds, loops: loops, handicapValues: handicapValues)
userData.myHandicap = spherical(10*handicapValues[handicapValues.count-1].whsHC)/10
},
secondaryButton: .cancel())
}
It’s within the PersistentController Class that I do the calculations for merchandise in objects. I do know the overall variety of objects so it’s straightforward to calculated the share performed. What I would like is: convey this worth again to the UIView to help a progress bar for the consumer to not get impatient.