|
I am working on sectioning the expenses on personal and business I am getting the following error: Referencing initializer 'init(_:content:)' on 'ForEach' requires that '[ExpenseItem]' conform to 'Identifiable' Not sure why because my expense item conforms to identifiable.
So, I am not sure why it thinks it doesn't conform to Identifiable when ExpenseItem does. Can someone explain that to me. Thanks Taz |
|
The items inside an array can be I can't test this right now because I'm away from my computer, but you could try something like:
|
|
Thanks @roosterboy for the help so far, I will tell ya, I am confused on your suggestion: I have tried this:
I get the following errors: I guess I am just confused on this. Any help here would be appreciated. I am sure I am missing something just not seeing it right now. Taz |
|
@roosterboy Thanks for your help. I couldn't understand what you were refering to. I would love to learn more about how to make the array itself conform to identifiable. So, what I ended up doing was making ExpenseItem conform to Hashable and then used .self. Heres the code
Now it shows them sectioned out. It also deletes them as well. If you feel up to it, as I said I would like to understand better your suggestion. I just couldn't get it to work. Thanks again Taz |
|
Inside the Instead, try this (I'm using
This takes the Here's an example using
Note, too, that the |
|
Thanks, I will give that a try, i don't think i would have gotten that had you not explained it. Thanks, |
|
|
|
It's definitely a much simpler solution ans simple is in my opinion easier to maintain. Thanks again for your help. I think I'll stick with what I got. |
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.