Hey, how is everyone doing? I was on vacation and on a business trip and couldn’t find a lot of time to work on my app
Just some progress:
- I created the expanded card view, showing more details of the season and only if data is present. Just for the sake of learning, I also did stuff like a text view which iterates over an array of text (the driver names).
- I implemented the onTapGesture to switch between collapsed and expanded card view (that was really easy! Just one variable and an if/else clause. Initially I thought, I would need to have more variables/code, but … yeah, more or less this is the trick:
@State private var idSelection: Int = 0
// Some more code
// List of cards
ForEach (F1season.seasons) { s in
if idSelection == s.id {
// View for extended card
ZStack { ... }
}
else {
// View for collapsed card
ZStack { ... }
}
.onTapGesture {
idSelection = s.id
}
}
- In a side project, I learned how to animate between Vstack and Hstack views → this will be handy for a smooth transition in this app. This will slightly change the above code!
Next:
- Animate the transition from a collapsed to an expanded view and vice versa.
- Dynamically adapt the size of the expanded card to the text content. (I think I know how to do that, I will try to use push out / pull in view containers (not sure if this is the right expression)). This will be the final tasks for the Platinum stage.