Productivity & personal

Build a countdown widget app with AI

A native countdown widget build brief for exams, trips and birthdays, covering saved events, home-screen widgets and honest day counts.

Apirex TeamUpdated AndroidiOS
On this page
  1. Screens
  2. Data model
  3. Native features
  4. Android notes (Kotlin and Jetpack Compose)
  5. iPhone notes (Swift and SwiftUI)
  6. Copy-paste prompt
  7. Acceptance test
  8. Frequently asked questions
5screens
3data tables
174word prompt
2platforms: Android, iOS

Finals are 23 days away and the number should be staring at you from the home screen, not hidden inside an app. This brief describes a small countdown app whose real product is the widget. It suits iPhone especially well because WidgetKit widgets are a familiar part of the home screen there, and an Android version uses Jetpack Glance; iPhone builds need a Mac with Xcode. The first release proves one thing: add an exam date, place the widget, and watch the count drop by exactly one at local midnight without opening the app.

Screens

  • Countdowns: List every saved event with days left, sorted by the nearest date
  • Add event: Name it, pick the date, an emoji and whether to count school days or all days
  • Event detail: Show days, hours and a short message that changes as the date gets closer
  • Widget picker help: Explain how to add the widget and which event it shows
  • Past events: Keep finished countdowns with the day they ended instead of deleting them

Data model

Countdown records shared with the widget
TableKey fieldsPurpose
eventsid (uuid), title (text), target_date (date), emoji (text), counting (text)The thing being counted down to, stored as a calendar date, not a timestamp
mood_stepsid (uuid), event_id (uuid), days_left_at_most (int), message (text)Optional messages such as 'chill' at 30 days and 'panic' at 3
widget_choiceswidget_id (text), event_id (uuid)Which saved event each placed widget instance displays

Everything stays on the device: there is nothing private to sync and no reason for an account. The catch is that the widget runs in a separate process, so the app and the widget must read the same store, an App Group container on iPhone and the app's own DataStore or Room database on Android. Save the target as a plain date plus the owner's chosen counting rule so a trip abroad does not shift the exam by a day. If cross-device sync is wanted later, connect your own Supabase and scope events to their owner with row-level security.

Native features

The whole idea depends on the operating system redrawing the widget on schedule. Both platforms ration widget updates, so the design gives the system a timeline of future entries instead of hoping for frequent refreshes.

FeatureAndroid (Kotlin)iPhone (SwiftUI)Notes
Home-screen widgetJetpack Glance GlanceAppWidgetWidgetKit TimelineProviderProvide entries for each upcoming midnight so the number changes without the app running.
Choose which eventGlance configuration activityApp Intents configurable widgetEach placed widget remembers its own event; deleting that event shows a gentle pick-another state.
Midnight rolloverWorkManager daily refresh plus date-change broadcastTimeline reload policy .after next midnightRecompute from the stored date on every render; never decrement a saved counter.

Android notes (Kotlin and Jetpack Compose)

Build the in-app list with a LazyColumn keyed by event ID and a Material 3 DatePicker in the add sheet. The Glance widget should read from the same repository through a small suspend function that returns the event title, emoji and days left.

  • Calculate days left with java.time LocalDate in the device zone, and for the school-days rule skip Saturdays and Sundays explicitly. Keep that function pure and unit-test the last day, the target day and the day after.
  • Call GlanceAppWidget.updateAll after any edit, and schedule a periodic WorkManager job near midnight as a fallback. Register for ACTION_DATE_CHANGED and ACTION_TIMEZONE_CHANGED so manual clock changes refresh the number too.
  • On an Android phone, place two widgets showing different exams, delete one event in the app, and check that widget shows a clear choose-again message. Change the date to tomorrow in Settings and confirm the other widget drops by one.

iPhone notes (Swift and SwiftUI)

The app target and the widget extension share a SwiftData container inside an App Group. Use a NavigationStack for the list and a sheet for adding events, with the emoji shown large so the widget preview matches what the person picked.

  • Make the widget configurable with an AppIntent whose parameter is an AppEntity for saved events. Supply small and medium families first; a lock-screen accessory can follow once the main widget is correct.
  • In the TimelineProvider, emit one entry per upcoming midnight for the next few days and use the .after policy. Call WidgetCenter.shared.reloadAllTimelines() whenever the app saves, renames or deletes an event.
  • On an iPhone, add a widget, choose an exam, then set the clock forward past midnight and return to the home screen. The count should change once, the mood message should step down when it crosses a threshold, and VoiceOver should read a full sentence.

Copy-paste prompt

Build this yourself 172 words · Android
Build me an exam countdown widget for my home screen: days left till finals, and an emoji vibe check that gets scarier as the date gets closer. Make it a native Android app where the widget is the main feature. Screens: Countdowns, Add event, Event detail, Widget picker help and Past events. Save events locally with a title, a calendar target date, an emoji and a counting rule of all days or school days only. Let me add optional mood messages that switch at day thresholds I choose. Share the data with the widget correctly, let each placed widget pick its own event, and update the number at local midnight without opening the app. Always compute days left from the stored date, never from a counter. Show friendly states for no events, a deleted event on a widget and an event that has already happened. No account, no ads, no network. For acceptance, add my exam, place the widget, move the clock past midnight and show the count dropped by exactly one.

Opens Apirex with this prompt in the box. Pick the Android · Kotlin tab before you send.

Acceptance test

  1. Add Physics final 23 days from today with a book emoji and confirm the list and detail both read 23 days.
  2. Place the widget on the home screen, choose that event, and check the number and emoji match the app.
  3. Advance the device clock past local midnight and return to the home screen; the widget should read 22 without launching the app.
  4. Switch the event to school days only and confirm weekends drop out of the count consistently in the app and the widget.
  5. Delete the event while its widget is placed and verify the widget asks for a new event instead of showing a stale number.

Check the edges people actually hit: the target day itself should say today rather than zero days, the following day should move the event to Past events, and changing the phone's time zone on a flight should not make an exam jump forward or back. Also confirm that a second widget pointing at a different event keeps its own choice after the phone restarts.

Frequently asked questions

Why does my widget not update every second?

Both systems limit how often a widget redraws to save battery. A day counter only needs one change per midnight, which a timeline of future entries handles reliably; a live seconds display belongs inside the app.

Is this the same as a study planner?

No. The school schedule blueprint covers classes, rooms and homework. This one does a single job, counting down to dates you care about, and keeps that number visible on the home screen.

Can a countdown remind me too?

A reminder a day before is a reasonable second step with a notification permission request. Keep it optional, and make sure declining it leaves the widget working exactly as before.

Build this blueprint

The blueprint prompt, ready for your platform. Edit anything before you send it.

AndroidKotlin · Jetpack ComposeReal source on your computer

Opens Apirex with this prompt. Pick the Android · Kotlin tab before you send. The Free plan includes 5 Rex Credits a day.