|
Hello everyone!
GRID LAYOUT:
Same problem in ListLayout What am I doing wrong? |
|
@TooMaa has a coding problem:
When I coach programmers, I steer them away from short repetitive class and variable names. Instead, I encourage them to use longer, descriptive names. Why? Yours is a great example where short names may have tripped you up. You're thinking you have a problem with understanding Swift, or SwiftUI. But I think the problem is with your variables leading you astray. What is the difference between mission, missions, Missions, and [Missions] ? You have a json file that contains a large collection of mission objects.
How would more descriptive names help you? I might recommend you call your class: Then when you decode the JSON file, you have a collection of SingleMission objects, like this:
Now, what exactly do you want to send to your GridLayoutView ? A single mission? or a collection of single missions? Much ConfusionIn your definition, you declare your GridLayout view to have a variable named Yuck! Do you see how confusing this is?
More Descriptive NamesIf you revise your code, and rename your classes, structs, and variables, you'll have a better understanding.
Please let us know how you solved your problem. |
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.