|
Hello i want to rewrite code from Swift to SwiftUI but i cant
i got
View:
Image: (if image doesnt show https://postimg.cc/xNGw49J7 |
|
It's a little hard to suggest alternative approaches with so little code to tell us just what you're trying to do. But I would suggest 1) use |
|
Just sort the dictionary with something like - |
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! |
|
i dont want to work with hardcoded datatypes(create struct...). because in json (each object has array) can be added new objects, (from database). and i want to read that objects from json. i want to rewrite the code to SwiftUI. i did that in swift correctly with this code: example json:
swift code :
|
|
can you try this , is this what you want ? no error so far , gives me Burgres in list
|
|
@AmitShrivastava yes but what if i want to access food_name(variable and value and print it) in every object, in dictionary for example: food_name : Hovadzi Burger update :
|
|
@localhost - the error can be resolved by using
But its not showing any thing on list, i tried a few things myself, but its not giving the results |
|
@AmitShrivastava
Im trying something like this: but i get
|
|
In SwiftUI,
I don't know how helpful this will be in your case. But maybe it will be useful. |
|
You don't even need to know the keys beforehand:
And, bonus, you don't need the check for a Or, if you object to the force unwrap on principle or from an abundance of caution, you can enumerate the elements of the
|
|
Lol... I was trying to figure out how to use Easy, Thanks. I don't know why I couldn't think of that. |
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.