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      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out 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.