Car Challenge Day 2
Alright, well today I got halfway through the level two requirements so far. Here’s what I’ve got.
Here’s my GitHub Repo:
Things I’m Stuck On Currently:
1. Only allow one card to be expanded at a time & first card starts expanded
Right now, the isExpanded property is owned by the CarCard. The problem is that means each card can be expanded or collapsed irregardless of the others.
Originally, I wanted my CarModel to maintain a Published property called “selectedCar” that stored the id of the car to be selected. I was going to set that property as the first car in the initializer. I got kinda far on that and then found that it just wasn’t working. When the user clicked the button on the card, it was changing the property in my model as expected, but the view wasn’t reloading. Perhaps I needed to involve a state property somewhere . . . Or maybe I need to make my model an environmentObject instead. Gosh I need to brush up on that.
Currently abandoned that train of though in my ExpandedCards branch and moved to an ExpandedCards-2 branch to start over. Sigh.
2. Size of card calculated dynamically since size of detailView can change
Right now, my card height is calculated dynamically. BUT it’s only switching between two set heights for expanded or not-expanded. It’s not causing any problems right now, but I know it doesn’t meet the specifications and would cause problems with other data. Honestly, I have no ideas where to go with this right now.