If I deleted a city and then added a new one, the index got messed up within the TabView. I reorder the index values after deleting a city. This helps with programmatic navigation.
Added progress view when first loading.
Added Settings view to switch between Fahrenheit and Celcius.
Added app icon.
Clean up code, added comments on where to find more info on the Combine parts in my book.
Tweaked UI, adjusted some padding, added background to hourly temps.
Thank you for your support, Ralph! If you look in the code comments you’ll find references to specific parts of the book. Should get you pointed in the right direction to learn more in the book examples.
Found the API endpoint for scores by date (to get yesterday’s data)
Found the API endpoint for schedules (it’s on the same page, so that’s handy)
Team Images
Looks like there’s a different endpoint called “Teams (All)” to get all the team images and color palettes?
Could be interesting to use these colors in the UI.
Problems
Thinking about how to cache the team info so I only need to get it one time. Thinking Core Data is a good solution, but man, I haven’t used Core Data for anything at work so I never really used it. Not sure how much time I want to invest in learning it.
Anything I start to learn usually turns into a separate reference product which is very time-consuming. So first, I’m going to research quicker solutions and maybe have to learn Core Data after. This will be a good challenge for sure!
Man, I hate to say this but I think I’m going to have to throw in the towel on this challenge!
There is a lot of exploratory research I want to do to make this work such as:
Explore using the NSCache object
Explore persisting with a file
Explore persisting using Core Data
I think these topics could be a lot of fun to play with but then I look at other priorities on my plate right now:
My plan was to call the Teams (All) API endpoint and store all the team data locally. This API gets me this data:
struct TeamDO: Decodable, Identifiable {
let id: Int
var city = ""
var name = ""
var primaryColor = ""
var secondaryColor = ""
var tertiaryColor = ""
var imageUrl = ""
enum CodingKeys: String, CodingKey {
case id = "TeamID"
case city = "City"
case name = "Name"
case primaryColor = "PrimaryColor"
case secondaryColor = "SecondaryColor"
case tertiaryColor = "TertiaryColor"
case imageUrl = "WikipediaLogoUrl"
}
}
So I wanted to persist them and then when I got score info, I could access this local data and get the full team names, logos, colors.
Well, good luck to everyone else on the challenge!