Module 04 Β· SwiftUI: First Screens β Lesson 4 of 4 Β· ~14 min
How the App Starts
Where does an app begin?
You can write views all day, but something has to tell iOS which view appears when the user taps the PawWalk icon. That something is a struct conforming to the App protocol β the twin of View, one level up.
- An
Apphas abodytoo, but its type issome Scene, notsome View. A scene is a chunk of UI the system manages β on iPhone, essentially "the app's window". WindowGroupis the scene you'll use: "give my content a window to live in." Whatever view you put inside it becomes the root of everything on screen.@mainis an attribute that marks the entry point: "iOS, start here." Exactly one type per app gets it.
PawWalk's entire entry point is 14 lines. Here it is, for real: