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

Day 17: What's the difference between a "Storyboard", a "ViewController", and a "DetailViewController"?

Forums > 100 Days of Swift

They all seem to be identical in my mind. They all seem to be simply screens within the program. The names seem arbitrary to me and don't carry any weight. Can someone elaborate?

3      

A storyboard is a graphically-based way of designing your app's GUI and hooking up the visual elements with the classes that give them functionality.

A ViewController is a class that gives a View the ability to do things. Without a ViewController, a View is pretty dumb and can't do a whole heck of a lot. The ViewController gives the View its smarts. The ViewController, among other things, handles the user's interaction with a View.

A DetailViewController is only a name given to a ViewController that works with a View in your project that presents details of something. It's not really a separate thing, just a name for a particular ViewController in that project, called such because the View it is managing is showing details of whatever the user selected in the previous screen. You can name your ViewControllers anything you want, although it's customary to give them names that tell you a little bit about what they do.

4      

Hacking with Swift is sponsored by Essential Developer

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.

Click to save your free spot now

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.