Sign In Sign Up

RUC tracking app for multiple vehicles

I have a basic, empty ios swiftUI app in the current folder. The app is a new, basic app to record the RUC (Road User Charges) for a car. You should be able to add 1 or more cars (by number plate - eg ABC123), and be able to track the current odometer value for that car over time. I also want ot be able to project when the RUC will expire - when the car hits a specific mileage. The front screen should show the list of cars, the last recorded mileage, and a projection of how long it is before the user needs to buy more mileage

I built the MVP you described.

What you can do now

  • Add one or more cars by plate.
  • For each car, set the RUC expiry odometer (km).
  • Add odometer readings over time.
  • See, on the home screen, each car’s latest odometer and a projection to RUC expiry:
    • If there’s enough history, it shows estimated days left and date.
    • Otherwise it shows km remaining to expiry.

How it works

  • Data model: Models.swift
    • Car: plate, expiryOdometer, entries: [OdometerEntry]
    • Projection uses average km/day from the last 30 days (falls back to all entries if fewer than 2 recent) to estimate days remaining and the projected expiry date.
  • Persistence: CarStore.swift
    • Simple JSON file in the app’s Documents directory. Auto-saves on changes.
  • UI:
    • App entry: RUCBuddyApp.swift provides a CarStore and shows the list.
    • Views: Views.swift
      • CarListView: home screen with list, add button, and per-car projections.
      • AddCarView: add a car with plate and RUC expiry odometer (km).
      • CarDetailView: summary, add reading (date + odometer km), history, and edit expiry odometer.

Notes

  • Units are km.
  • “RUC expiry odometer” means the odometer value at which your current RUC block ends. Distance left = expiryOdometer - latestOdometer.

Next improvements (tell me what you want and I’ll add):

  • Store “license size” and “odometer at purchase” instead of raw expiry, so the app computes expiryOdometer automatically.
  • Better input helpers (e.g., numeric toolbar), validation, notifications when near expiry, iCloud sync, widgets, etc.

Would you prefer entering RUC blocks as “km purchased” + “odometer at purchase” instead of the direct “expiry odometer”?

no, just expiry odometer

Got it. The app already uses only the expiry odometer.

Want any tweaks?

  • Warning threshold: show “Due soon” when fewer than N km or days remain. What threshold do you want?
  • Sorting/formatting: group cars by “due soon,” color badges, or show both km left and ~days.
  • Deployment target: I can lower the iOS target (currently 18.5) to silence warnings. What minimum iOS version do you want? (e.g., 16.0 or 17.0)

If you’re happy as-is, I can add a small “Settings” row per car to quickly bump the expiry odometer when you buy more RUC.

yes please. Can you also add the initial odometer reading when you add a car?

Done.

What changed

  • Add car: You now enter an initial odometer reading (and date) when creating a car. It creates the first history entry.
  • Quick bump: In the car detail screen, there are quick actions to bump the expiry odometer by +1000 km or +5000 km without entering edit mode.
  • Due soon styling: The list highlights soon-to-expire cars:
    • Orange if <= 500 km left, or if projected <= 7 days.
    • See Views.swift.

Validation

  • Add Car form requires: plate, initial odometer >= 0 and less than the expiry odometer, and expiry > 0.

Build status

  • Built successfully. One warning about deployment target (project is set to iOS 18.5; current SDK supports up to 18.2).

Want me to:

  • Adjust the quick bump sizes or thresholds?
  • Lower the iOS deployment target (e.g., 17.0) to remove the warning? If yes, tell me your minimum iOS version and I’ll update the project.
no, they are good, but they appear to add somewhat random amounts to the expiry oddometer. +1000 goes up by 6000 for eg

Thanks for the heads-up. That’s likely the Form row treating the two inline buttons oddly and both actions firing. I’ve changed “Quick bump” to a single Menu so only one action executes per tap.

What I changed

  • Replaced the two inline buttons with a menu:
    • Tap “Add” → choose +1,000 km or +5,000 km
    • See Views.swift

This should eliminate the random multi-increment. Try it now and tell me if it behaves correctly. If you prefer, I can make it a Stepper (e.g., step 1,000) or keep both preset amounts in separate rows.

CAn you take the "Add" label off, and just leave the (+) icon - the menu is awesome.

Done. The quick bump menu now shows only the plus icon.

Where to see it

If you’d like, I can switch the icon to plus.circle.fill or add a tint.

that looks good. CAn you swap the history and RUC settings around, as the history is less important

Done. On the car detail screen, RUC settings now appears above History.

Changed in Views.swift and the History section follows it at Views.swift.

Want me to tweak anything else on that screen (e.g., collapse History by default, show last 3 with a “See all”)?

ok first up, lets commit that to git. Good to have a check point! The idea around the history is good too. Lets do that

Great call.

I’ve:

  • Committed a checkpoint with everything so far.
  • Implemented History collapse (shows last 3 readings by default with a Show all/Show less toggle).
  • Committed that change too.

Commits

  • Checkpoint: add RUC tracking MVP
  • Detail: collapse History by default, show last 3 readings with Show all/Show less toggle

Code reference

Want me to:

  • Add a disclosure chevron for History instead of a button?
  • Sort car list by soonest-to-expire?
> Sort car list by soonest-to-expire? yes please

Sorted by soonest-to-expire and committed.

What I changed

  • Car list now orders cars by:
    1. Expired first
    2. Then by projected days remaining (ascending)
    3. Then by km remaining
    4. Tie-breaker: plate

Code

Commits

  • Sort car list by soonest-to-expire (expired first, then projected days, then km remaining)

Anything else you want to adjust about the sort (e.g., always show km left next to the days on the list)?

can you add git@github.com:nicwise/RUCBuddy.git as the remote and push to it. It's on github, so you can use gh if you need to

Remote added and pushed.

What I ran

  • Added remote: git remote add origin git@github.com:nicwise/RUCBuddy.git
  • Pulled with rebase to integrate remote main: git pull --rebase origin main
  • Pushed main and set upstream: git push -u origin main

Your GitHub repo nicwise/RUCBuddy now has the latest commits.

can you write a readme for this, including the screenshots which are in shots. The filenames indicate what they are of
Created README.md
+78
please add the images too - in the shots folder

Added the screenshots and pushed.

  • Added:
    • shots/1-homepage.png
    • shots/2-ViewCar.png
    • shots/3-QuickAdd.png
    • shots/4-NewCar.png

README already references them at shots/....