|
I have been trying to make a very basic bill tracking app as my first solo project (in SwiftUI) after finishing SwiftPlaygrounds 1-3. I have gotten the views mostly setup for a skeleton, but I keep running into walls trying to save data input from text fields into an array and then display those array objects in a list. (Don't mind I have the notifications functionality and stuff "//" out until I get the core working) I need to have input of a bill name and amount, so I made a struct called Bill Entry. When I try to append an instance of that struct into the array "entries" it just throws an error that it's too ambigous. When I use the $var version it throws an error saying I can't use binded entries and/or partial mutations. I am very new and struggling not to just give up as everything I have googled/tried seems to throw a different error, and I am really not sure what the heck I am doing so wrong to just make something simple like this. I have stepped back and worked through some basic task list apps and the like via youtube tutorials, and those seem to work, but I cannot get my project to work at all on this front. Anyone able to help, but more importantly explain the WHY on this so I can learn more and not just continue bashing my head into the magical wall of errors? Any/All help is appreciated; here's my working code (I think I formatted it right?):
|
|
Take a look at this:
Three points:
|
|
Thank you! That fixed it, I am still trying to learn all this, so I appreciate you both showing how its solved and telling WHY that solved it, you rock! |
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.