100 Days of SwiftUI

Day 18

2026-05-06

Project 1, part three

WeSplit: Wrap up

The project is complete, so let’s review what we learned, take a little test and then do some practice

Quiz: WeSplit review — 11/12

Challenges

  1. Add a header to the third section, saying “Amount per person”

This was pretty easy — hardest part was finding the right section. Section ("Amount per person") {...}

  1. Add another section showing the total amount for the check

This was tougher. We already calculate the total amount in the variable totalPerPerson but it turns out that computed variables can only return one thing. But I don’t want to recalculate the amount! So I turned totalPerPerson: Double into totals: [Double] and return an array return [totalCheck, amountPerPerson]. It’s unsatisfying to call out total[0] though.

  1. Change the tip percentage picker to show a new screen rather than using a segmented control, and give it a wider range of options – everything from 0% to 100%. Tip: use the range 0..<101 for your range rather than a fixed array.

Easier, except I had to look up the pickerStyle (.pickerStyle(.navigationLink))

Commentary

This was a very simple app, and we were basically just copying what he said to do. The challenges were pretty straightforward, though I am looking a lot of stuff up.

The issues I had were around ranges that act like arrays. Maybe if I think of a “range” as a “list” then it might make sense? I dunno.

I see why there are a lot of tip-splitting apps!