UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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 Superwall

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

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

Archived topic

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.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.