NEW: Subscribe to Hacking with Swift+ and accelerate your learning! >>

Day 33 - Project 7

Forums > 100 Days of Swift

Hey all,

One thing I'm not understanding about Day 33/Project 7 is why 2 files called 'users' and 'user' get created. I've toyed with JSON data on several small test/learning apps and I seem to be able to slap structs in my ViewController and use them to point Decodables to the right section in the JSON data I download.

So, what's the logic behind it? Is it to keep the code cleaner (in that case, why create two files) or is there a deeper reason my inexperienced self isn't seeing? :-)

   

Hey Eric, I think it's for the purpose of keeping code cleaner. The code works regardless of if you want to slap them in the current viewController or create 2 seperate ones, but since there are already a viewController class with a bunch of code in it, it's just prettier and way less messy to create 2 clean files, saves us some scrolling.

Just my opinion, there may be a technical reason i don't know about? Let's see what the rest of the community have to say :)

   

Hacking with Swift is sponsored by NSSpain

SPONSORED Announcing NSSpain 2020: Remote Edition! An online, continuous conference for iOS developers. We’ll start on Thursday and finish on Friday, with talks, activities, and lots of fun for 36 hours, non-stop. Sound good? Join us!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

Not logged in

Log in
 

Link copied to your pasteboard.