|
I'm trying to learn SwiftUI by writing a simple chess browser. I have written a model that reflects the rules of the game. Hopefully its design will be relatively clear from usage, please let me know if not! I'm trying to write a "column view" like the one in the Finder (called Here's my code so far:
The preview looks like this: The idea being that when a move is selected, the next column appears showing what moves may be made in response to that game state. So, each The browser's state is an array of Everything is values rather than objects. I have the code for setting and changing the Could anyone please advise me on the idiomatic SwiftUI way to achieve this? (BTW I'd be very happy to discuss generalising this browser component as well, but I don't think I'm anywhere near that level yet!) |
|
its hard to totally follow that, does the model with the information on the game moves live outside the view, I assume it does. |
|
Hi Eoin, Thank you for your reply! Yes, the model is outside of the view. For example in the Then, in the example On either such Beyond chess, though, what I'm really trying to ask is how to model an Thanks, Hamish |
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.