Tip and Bill Splitter
Build a simple iPhone app with SwiftUI that calculates the tip on a restaurant bill and splits the total between friends. Type the bill amount, pick the tip percentage (with quick buttons for common values or a slider), choose how many people are paying, and the tip, total and amount per person update instantly as you change anything. Amounts are shown in your local currency format, and there's an option to round each share up. It's a perfect first iOS app: you'll learn SwiftUI views and layout, @State and data binding, computed properties, text fields with number keyboards, formatting currency, and writing a few unit tests.
- Estimate
- ~5.5h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
SwiftUI
Project roadmap
- 01
Build the bill input
~1hCreate a SwiftUI app with a Form containing a TextField for the bill amount bound to a Double (or Decimal) with the currency format style (format: .currency(code:) using the user's locale), and the .decimalPad keyboard. Add a Done button in the keyboard toolbar to dismiss it, using @FocusState. Done when: the bill amount can be typed and is shown in local currency format.
- 02
Add the tip percentage
~1hAdd a segmented Picker with 0, 10, 15, 20 and 25 percent, plus a Slider (or Stepper) for a custom percentage from 0 to 50, both bound to the same @State value so they stay in sync. Done when: choosing a preset or moving the slider changes the tip percentage shown.
- 03
Add the number of people
~0.5hAdd a Stepper for the number of people from 1 to 20, showing the current number in its label. Done when: the number of people can be changed within its limits.
- 04
Compute the results
~1hAdd computed properties for the tip amount, the total, and the amount per person, with a Round up toggle that rounds each person's share up to a whole unit (and shows the resulting extra tip). Put the math in a separate struct so it can be tested. Handle an empty or zero bill gracefully. Done when: results update instantly and are correct for examples calculated by hand.
- 05
Style the results
~1hShow the results in a clear section with the per-person amount largest, format all money with the locale's currency, and make the layout work in dark mode, with larger text sizes (Dynamic Type) and on small screens. Done when: the app looks tidy in light and dark mode and with large text.
- 06
Test it
~1hWrite unit tests for the calculation struct: normal cases, 0% tip, one person, rounding up, and a zero bill. Done when: the tests pass in Xcode.
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack