Var is not saving my new Int SwiftUI / @State var static

Viewed 70

I calculate in a external function how much days are left. So its an Int. Then I paste the "tageÜbrig" (Int) in daysLeft. And then I want to show the Int (daysLeft / tageÜbrig) in a Label But its not working. So there must be an issue with saving the Int in the static var. What should I use instead that I can show the Int in my Label? Is it right that I use a Satic var ? Because its in a external Function so I need something that I can edit there..

func fetch(){ 
let tageÜbrig = userTage - tageUm 
ProgressView.daysLeft = tageÜbrig 
} 

@State static var daysLeft = 0

Text("Keep going! Only \(ProgressView.daysLeft) days left!")

0 Answers
Related