100 Days of SwiftUI
2026-05-04
Today we’re starting to work with SwiftUI. The preceding days were for getting some background in the Swift language itself, but for the rest of the course we will be making several apps.
This is pretty exciting!

WeSplit: Introduction
This project is a check-sharing app that calculates how to split a check based on the number of people and how much tip you want to leave.
Understanding the basic structure of a SwiftUI app
Of course I spent time changing colors. I haven’t figured out how to change the XCode navigation panel background though (it may not be possible)
Creating a form
Formis a dedicatedViewtypeSectiongroups related things on the screen
Modifying program state
- views are a function of their state — that everything the user can see is just the visible representation of the structs and properties in our code
@Statemakes a “property wrapper” so yourstruct ContentView: Viewcan have updatable properties@Stateis specifically designed for simple properties that are stored in one view- keeping structs small is good for performance
- let’s play with buttons!
- interesting that
Buttonmakes a clickable object, but does not make a button shape
Binding state to user interface controls
- given the example of a
TextField— in order for Swift to both read from and write to a state variable (two-way binding), the parameter in the UI call needs a$in front of it - if you’re only reading the value you don’t need the
$marker
TextField("Enter your name", text: $name)
Text("Hello, \(name)!")Creating views in a loop
ForEachcan loop over arrays and ranges, creating as many views as needed- For example, a
Pickerwith a list of names to choose from \.selfgives SwiftUI a way to discriminate between views made from the same stuff
struct ContentView: View {
let students = ["Vinnie", "Horshack", "Boom Boom", "Epstein"]
@State private var selectedStudent = "Vinnie"
var body: some View {
NavigationStack {
Form {
Picker("Select your student", selection: $selectedStudent) {
ForEach(students, id: \.self) {
Text($0)
}
}
}
}
}
}Over the last year or so I was making apps in Microsoft PowerApps which are very much data-driven, and each screen is its own thing. I wonder how app views are structured in SwiftUI. I suppose I will find out soon!