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? :-)

3      

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 :)

3      

Hacking with Swift is sponsored by RevenueCat

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.

Learn more here

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.