|
Hi all, Based on the expense project, i tried to apply the what i learned on an app. However i am facing an issue that i am not able to find a solution. I have two sections: the first one contains ingredients and the second section which is empty should have all ingredients choosed from the first section. I have created a class, which i add items that needs to added to the second section. I am able to add items, however when i check the Thanks
|
|
The above initialises a new instance every time, thus if you don't have anything predefined it will be empty. You should pass around the @ObservedObject like this:
|
|
@Bern, Thanks for your response. I have tried it but no result. I still see 0 elements in
Quick question, the fact that uei this code below, shouldn't it work. My understanding is that class are reference type, so it should point to the same object unless i overrride it. Am i missing something ?
|
|
Here you have defined the
See if this helps
Be careful that your
Also, as Bnerd has already stated, the ObservedObject should declared as
See here for an explanation. |
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.