|
Hi guys, I'm pretty new to Swift and SwiftUI, and I've read a lot, but I'm currently facing a problem where I'm not sure what is the best way to pass data around. I tried to break it into some simple sample code, so you can see where my issue is:
As you can see, I have an array of objects of a custom class, which I pass to the bottom view, and display them in a list. Now, I want to be able to tap on the list items, so the object gets passed to the top view, where I can then modifiy it, and represent the changes in the list in bottom view immediately. I hope I was able to make the problem somewhat clear. I really hope someone can point me in the right direction how to handle something like this. Thanks a lot in advance! This site is awesome! Cheers! |
|
Try this:
Note: You don't need to do this kind of stuff in your
Just use the |
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.