Whelp I really wanted to figure this out but I guess it’s an area in need of learning better… I don’t get what it’s trying to ask for… I
Model:
struct Weather: Codable, Identifiable, Hashable {
let id = UUID()
let error: Int
let errorMessage: String
let forecast: [Forecast]
enum CodingKeys: String, CodingKey {
case error
case errorMessage = "error_message"
case forecast
}
}
You need to create a Weather
item and feed it into your RootView
.
1 Like
So you mean like, sample data?
In your preview, you could use sample data but in the actual app code you would want to use real data, I would think.
1 Like
So I did something… now Xcode can’t make up its mind from a bunch of errors to just the 1 where it says the RootView’s 1 error.
I made the project public http://github.com/sourkraut1991/AFSpaceA
Here’s RootView’s complaints
And my Model
Ok so I’ve gotten rid of all errors, but, I had to comment out my TODO (on second image) and delete the **let** weather: Weather"
that I had at the top.
In the 2nd pic, showing the RootView
, you defined a weather variable but what you’re passing into the HomeView
is a new weather object, is that what you intended to do??
Where do you want to create this weather
object (variable)
The 1st pic of the HomeView
you’re most likely missing a curly brace somewhere
1 Like
Hey Mikaela,
When taking a break and reading your words, I don’t know why I have so many constants of weather.
I think, I figured it out. However, I apparently chose a bad api to do this test with lol. only lets me do 10 queries a month!
I think I’ve fixed this though, by having my eyes woken from your observation, so thank you!
Now time to practice json with another api
Apple has WeatherKit that you could look into!
1 Like
They do, yes, I don’t remember why I opted not to… I’ll have to re-look at that. I’m assuming it’s due to how many queries were free.
Does apple have a currency type of SDK as well? Like, to see the dollar vs pound ratio. (Something I plan to google )
I also need to get the developer program. I’ve had it in the past… like years ago… but If I ever want the full capacity of learning CloudKit for instance, or WeatherKit, I’ll need a paid account.
Back in the day, I made a app where I could browse web on half of the screen, and have a text editor on the other half ( for school was my train of thought) for writing notes. It was that next iOS where Apple released being able to split screen making my idea obsolete lol
No I don’t think so, not for like currency conversion. You can format currency, but not convert it without using an API
1 Like