My view is called, but the default data is being used. My class is set like so
class UserWeatherData: ObservableObject {
@Published var currentDescription = "It's gonna rain!"
}
My view:
struct WeatherView: View {
@AppStorage("userTempChoice") var userTempChoice = "Fahrenheit"
@ObservedObject var weather = UserWeatherData()
var body: some View {
VStack {
Text("Tap Me")
.onTapGesture {
I set my data
}
}
}
}
Here is where things are not working for me and weather.currentDescription is using the default data set above and not what I set.
struct SampleWeatherView: View {
@StateObject var weather = UserWeatherData()
var body: some View {
Text(weather.currentDescription)
}
}