in my ScrollView i'm try to display the forecast received from internet request. The server if there is no data available for that specific item example windGust the default values is set to "0" (string)
Now on my ScrollView I want to hide the Text that contain zero, in order to show only the forecast item that have value.
so I put in my Group the if else state to check if display the Text or not, but if I put more than 3 if else state I get the warning 'The compiler is unable to type-check this expression in reasonable time'
I have 10 var to be display if the have value.. how can I show or hide if this have value different than "0"
Group{
if forecast.change_indicator == "0" {
Text(forecast.change_indicator).hidden()
} else {
Text(forecast.change_indicator)
}
if forecast.showTimeBecoming == "0" {
Text(forecast.change_indicator).hidden()
} else {
Text(forecast.showTimeBecoming)
}
if forecast.windGust == "0" {
Text(forecast. windGust).hidden()
} else {
Text(forecast. windGust)
}
}
Aucun commentaire:
Enregistrer un commentaire