Games & fun

Build a spin the wheel app to decide who pays for dinner

A fun decision wheel build brief: type your friends' names, spin with a dramatic slow-down, and share the result. Best as a web app anyone can open from a link.

Apirex TeamUpdated WebAndroidiOS
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. Web notes (best fit)
  7. Copy-paste prompt
  8. Acceptance test
  9. Frequently asked questions
5screens
3data tables
156word prompt
3platforms: Web, Android, iOS

Every friend group has the same fight at the end of dinner: who pays, who drives, who picks the movie. This brief builds a wheel that settles it with style. Type the names, tap Spin, and the wheel races, slows down painfully, ticks past the last few slices and lands on someone. The honest best fit is a web app: one link works on every phone at the table and nobody has to install anything. Native Android and iPhone versions are also possible with Compose and SwiftUI canvases, and the iPhone build needs a Mac with Xcode. The first proof: the slice the pointer stops on always matches the name announced, across fifty spins.

Screens

  • Wheel: The coloured wheel, a pointer, a big Spin button and the list of slices beside or below it.
  • Edit slices: Add, rename, reorder and delete names, with an optional weight for each.
  • Result: The winning name in huge type, a little confetti and buttons to spin again or share.
  • Saved wheels: Named sets such as Dinner squad, Movie night or Who washes up.
  • Settings: Spin length, sound on or off and a remove-winner-after-spin option.

Data model

Wheel data saved in the browser or on the phone
TableKey fieldsPurpose
wheelsid (uuid), name (text), created_at (timestamptz), remove_winner (bool)Each saved wheel and how it behaves after a spin.
slicesid (uuid), wheel_id (uuid), label (text), weight (int), colour (text), position (int)The names on the wheel, their order and how big each slice is.
spinsid (uuid), wheel_id (uuid), winner_slice_id (uuid), spun_at (timestamptz)A short history so the group can see who got picked last time.

There is no reason for an account or a server. On the web, keep wheels, slices and the last twenty spins in localStorage or IndexedDB; on a phone, use Room or SwiftData. A share link can carry the slice names in the URL itself, so a friend opens the same wheel without any database. If the owner ever wants public wheels with view counts, that is the moment to connect your own Supabase, not before.

Native features

Fairness and drama come from separating two jobs. First pick the winner with a proper random number, weighted by slice size. Then animate the wheel to land on that winner with an easing curve that slows down at the end. Picking first and animating second means the result can never disagree with the pointer, and it keeps the outcome independent of frame rate or a slow phone.

FeatureAndroid (Kotlin)iPhone (SwiftUI)Notes
Fair random pickSecureRandom with weighted selectionSystemRandomNumberGenerator with weighted selectionOn web, use crypto.getRandomValues instead of Math.random.
Wheel drawingCompose Canvas drawArc per slice with rotateSwiftUI Canvas or Path wedges with rotationEffectOn web, an HTML canvas redrawn with requestAnimationFrame.
Tick and buzzSoundPool tick and a short vibration per slice passedAudioServices tick and sensoryFeedbackBrowser vibration works on many Android browsers but not in iPhone Safari.
SharingShare sheet with the result text and a linkShareLink with the resultOn web, the Web Share API with a copy-link fallback.

Android notes (Kotlin and Jetpack Compose)

Animate an Animatable rotation from the current angle to the target angle, adding several full turns so the spin feels big. Compute the target from the chosen winner's slice centre plus a small random offset inside the slice so it does not always stop dead centre.

  • Pick the winner with SecureRandom over cumulative weights, then animate with a custom easing that decelerates for the final two seconds. Disable the Spin button and slice editing while the animation runs.
  • Play a tick each time the pointer crosses a slice boundary by comparing the previous and current angle per frame, and pair it with a light vibration if the user allows it.
  • On a real phone, spin fifty times with one heavily weighted slice and check the counts roughly follow the weights, and that every result card matches the slice under the pointer.

iPhone notes (Swift and SwiftUI)

On iPhone, a SwiftUI Canvas can draw the slices and a rotationEffect with a long ease-out animation handles the spin. Use a keyframe or timing curve animation so the final slow-down feels dramatic rather than linear.

  • Choose the winner before the animation starts, store it, and show the result only when the animation completion fires, so interrupting the app mid-spin cannot change who was picked.
  • Respect Reduce Motion: shorten the spin to a quick turn and fade, while still showing the same fair result.
  • Test on an iPhone with the ring switch on silent and VoiceOver on; the result must be announced aloud even when the tick sounds are muted.

Web notes (best fit)

As a React and Vite web app, the wheel is one canvas, a list and a few buttons. Make it installable with a web app manifest so friends can add it to their home screen, and keep everything working offline after the first visit.

  • Encode the slice labels and weights in the URL hash for share links, and decode them safely, trimming long names and limiting the slice count so a crafted link cannot freeze the page.
  • Scale the canvas by devicePixelRatio so slice text stays sharp on phone screens, and redraw only during a spin to keep battery use low.

Copy-paste prompt

Build this yourself 156 words · Web
Make a spin the wheel app to decide who pays for dinner with my friends. Best as a web app I can send as a link, and keep it ready for Android or iPhone later. Screens: Wheel, Edit slices, Result, Saved wheels and Settings. I type names, pick colours and can give someone a bigger slice as a joke. When I tap Spin, choose the winner first with a secure random number, then animate the wheel so it spins fast, slows down dramatically and ticks past the last few slices before landing exactly on that winner. Show the name huge with confetti, and let me spin again, remove the winner, or share the result. Save wheels, slices and the last twenty spins locally, no account. A share link should open the same wheel for my friends. Respect reduced motion and silent mode. Acceptance: after fifty spins the announced winner always matches the slice under the pointer.

Opens Apirex with this prompt in the box. Pick the Web tab before you send.

Acceptance test

  1. Create a wheel with five names, give one a double weight and save it as Dinner squad.
  2. Spin ten times and confirm the result card always names the slice under the pointer when the wheel stops.
  3. Turn on remove-winner and spin until one name is left; the wheel should redraw cleanly each time and refuse to spin with one slice.
  4. Share the wheel link, open it on a second phone and confirm the same names and colours appear.
  5. Turn on reduced motion in system settings and confirm the spin is short but the result is still random and correct.

Do a quick fairness check before showing it to anyone: run a few hundred automated picks with equal weights and confirm each name lands near an equal share. A wheel that secretly favours the first slice is the fastest way to lose a friend group's trust.

Frequently asked questions

Is the result really random?

Yes, as long as the winner is chosen with a secure random number before the animation starts. The spinning is only a show that lands on the pick, so phone speed and timing cannot bend the result.

Why is web the best fit for this one?

A wheel at a dinner table works best as a link everyone can open instantly. It needs no phone features beyond sound and maybe vibration, so a web app reaches every friend without an install.

Can I still make it a native app?

Yes. The Android and iPhone notes above cover the canvas, animation and sharing. The iPhone build needs a Mac with Xcode, and a native version could add a home screen widget later.

Build this blueprint

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

WebReact + ViteReal source on your computer

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