Mobile development

Stage 2 · Lesson 1 of 10

Views as structs

SwiftUI views and layout

In a view is a that conforms to the View protocol. It has a body property describing its content. Views are cheap values, created and thrown away constantly.

SwiftUI compares them and updates only what changed on screen. This is declarative UI. You build screens by combining small views.

So a ProductRow is an image, a of text and a price, and a list screen uses ProductRow for each item. Pull out a subview as soon as a body grows past a screenful. Because views are , they fit the structs you learnt in .

Common traptreating a view like a UIKit object that you keep a reference to and change later.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • CourseFree
    SwiftUI Tutorials (Apple)

    Apple · Beginner

    Apple's own path from views and stacks to lists and navigation

  • CourseFree
    100 Days of SwiftUI

    Paul Hudson (Hacking with Swift) · Beginner

    Days 16 to 35 build six small apps on views, modifiers, lists and animation

Practise

  • Use a free challenge's mobile design image as the spec for a native screen

Keep handy

Mark this stage as not done?