I am trying to make the animation progress to a certain number value. I get errors, I can't figure out what the reason is. SwiftUi IOS15
What are the parameters - Number: 600; Total: 1000
I am trying to run a progress animation to the number 600 out of 1000
let number: String
let total: Int
let timer = Timer.publish(every: 0.1, on: .main, in: .common).autoconnect()
ProgressView(name, value: Double(number), total: Double(total))
.onReceive(timer) { _ in
if number < Double(total) {
Double(number) += Double.random(in: 0...4)
}
}
UPD: This is part of the code that I didn't add initially
struct Params: Identifiable {
let id = UUID()
let num: String
}
extension Params {
static func getAll() -> [Params] {
return [
Params(num: "650"),
Params(num: "80"),
Params(num: "900")
]
}
}

