|
I wanted to extend the game to save the log of previos words alongside with a title of root word in header/first row and score for the game.
It's about working with a I thought to record in Also, is it possible to dynamically build rows in a This code doesn't work ('The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions')
|
|
First off, I admire the ambition. Good on you mate. Now, over the coming days / chapters you will learn about passing data between views, and how to model the data. For now though, here's some info, which you can choose to research deeper if you want: 1- You want to start with a decision of where to display this "stored" data. Most probably a new view? If yes, do you want it to be a NavigationView? or a TabView? Either way, that new view will need to be passed your saved data. A list needs one source of truth. That source can have multiple ways it gets the info, but the list needs to know something to work with. What dynamic means is that it only displays as many items as you give it, and will grow or shrink according to the data it gets. So to build it from different sources, as far as I know, is not possible or even wanted. It creates problems. What you can do is make the different sources dump their info into one source for the list to use. (but why do you want that anyway?) 2- When you say store, it usually means persisting the data. So the when the user terminates the app and relaunches the information is there. However, this is too early on your journey. I would recommend you stick the course until you learn how. For now though, what you want to do is figure out what that data should look like. Think almost as if it were a JSON file. So for example:
You then have an array of
The reason I added the conformance to |
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
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.