|
The following code creates a table-type structure, and the goal is for a particular, tapped box (not all the boxes) in the grid to change from an empty rectangle with a red border to a rectangle containing text with a white/black border. I could swear I got this to work before I slimmed down the code and moved the ZStack{}s into a separate struct. Then I tried to reverse engineer the original code because I forgot to commit it. But maybe I was hallucinating. π΅βπ« Right now, tapping a box correctly displays text in only that box, but all the borders are changing from red to white/black. ( Was I hallucinating? Or am I missing/misplacing a key word somewhere? What appears below should be identical or nearly identical to the original code I had. It has to be somewhere in the commented lines, as those are what had to be adjusted when I moved the ZStack to its own struct.
|
|
All of your boxes have a border color modifier controlled by the same property:
So if you change You should do something like this instead:
|
|
Ah, okay--thanks! Did my "compacted" version (below) work (changing the color of the tapped box only) because the Either way, I can eliminate the need for the
|
SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.