How to finish your first swift project

At 9:40 p.m., Priya’s TipSplit app builds in Xcode 15, but the total label still reads $0.00 after she taps Calculate. She has one SwiftUI view, two text fields, a button, and a label — and no idea whether she is ten minutes or ten hours from “done.” That is the real beginner wall in Swift: not starting, but deciding what finished means before the project grows another screen.

Priya’s finish line is deliberately small: one screen, one calculation, one demo she can show someone by Sunday. Here is the exact path she takes.

Give Priya’s TipSplit app a one-screen finish line

Write the finish line before you touch the code again. For TipSplit, “finished” means:

  • The app launches in the iPhone 15 simulator running iOS 17.
  • The bill field accepts a decimal amount, such as 42.50.
  • The tip control offers 15%, 20%, and 25%.
  • Tapping Calculate shows a total in US dollars.
  • An empty bill field shows $0.00 instead of crashing.

That is it. No history screen, no settings tab, no custom colors, no App Store listing. A free local build in the simulator is enough to finish a first Swift project. You only need the $99/year Apple Developer Program if you later install on a physical iPhone or use TestFlight.

Put the bill, tip, and total in one SwiftUI view

Open ContentView.swift and keep the state in one place. Priya uses three @State properties: one for the typed bill, one for the selected tip, and one for the calculated total.

struct ContentView: View {
    @State private var billText = ""
    @State private var tipPercent = 0.20
    @State private var total = 0.0

    var body: some View {
        VStack(spacing: 20) {
            TextField("Bill amount", text: $billText)
                .keyboardType(.decimalPad)
                .textFieldStyle(.roundedBorder)

            Picker("Tip", selection: $tipPercent) {
                Text("15%").tag(0.15)
                Text("20%").tag(0.20)
                Text("25%").tag(0.25)
            }
            .pickerStyle(.segmented)

            Button("Calculate") {
                let bill = Double(billText) ?? 0
                total = bill * (1 + tipPercent)
            }
            .buttonStyle(.borderedProminent)

            Text(total, format: .currency(code: "USD"))
                .font(.largeTitle)
        }
        .padding()
    }
}

The @State wrapper matters because SwiftUI needs to redraw the label when total changes. The .keyboardType(.decimalPad) line gives iPhone users a number pad with a decimal point. The .currency(code: "USD") formatter adds the dollar sign and two decimal places without string math.

Make the Calculate button update a single Text label

The most common almost-finished Swift project prints the result to the Xcode console. Priya does not do that. She makes the button write to total, and the Text view displays it.

The line Double(billText) ?? 0 is the safety net. If the field is empty or contains letters, the app uses zero instead of crashing. Test it by tapping Calculate with nothing typed: the label should show $0.00.

Keep the calculation in the button action for version 1.0. A separate model file, a view model, and a unit test target can come later. Finishing a first Swift project is about closing the loop from tap to visible result.

Test three bills in the iPhone 15 simulator

Press Command-R in Xcode and choose the iPhone 15 simulator. Run these three cases:

  1. Bill 42.50 at 20% should show $51.00.
  2. Bill 0 at 20% should show $0.00.
  3. Bill 100.50 at 15% should show $115.58.

If the decimal keyboard covers the Calculate button, connect the hardware keyboard in the simulator with I/O > Keyboard > Connect Hardware Keyboard, or add a Done button above the keyboard later. Do not redesign the screen to avoid a keyboard problem you can see and name.

Delete every feature that is not the total

Priya’s notes app has a wish list: split by party size, save history, custom currency, dark mode, a tip slider. Every one of those is a reason the project stays “almost done.”

Move them to a folder called Later or a text file called next.md. If a Swift file is not needed to launch the app and show one total, it does not belong in version 1.0. A finished one-screen app beats a half-built five-screen app every time.

Ship a demo build with a screenshot and a 60-second script

Finishing includes proof. In the simulator, press Command-S to save a screenshot named TipSplit-20-percent.png. Create a plain README.md with three lines: what the app does, how to run it in Xcode, and what it does not do yet.

Then record a 60-second demo on your phone or with QuickTime. Open the app, type 42.50, choose 20%, tap Calculate, and show $51.00. That demo is the difference between “I’ve been learning Swift” and “I finished a Swift project.”

Stop at version 1.0 and write down the next step

Before Priya closes Xcode, she duplicates the project folder and names it TipSplit-v1.0. She writes one sentence in next.md: “Version 1.1 will split the total by party size.” Then she stops.

That is how a first Swift project gets finished: a narrow screen, visible state, three test bills, a screenshot, and a decision to stop. The next feature can wait. Version 1.0 is already real.