Docs
Feedback

Outcome Screen

A success, failure or empty state in one choreography: a ring draws, floods and lands with a haptic, then a glass action rises.

$npx swiftpieces add OutcomeScreen
Free · MIT + Commons ClauseiOS 17.0+Liquid Glasssuccesserroremptyretrycompletionhaptic
Type
OutcomeScreen
Files
OutcomeScreen.swift
Depends on
Nothing (Apple frameworks only)
Version
2.2.0
In a full screen · SwiftPieces ProPurchaseA complete StoreKit 2 purchase: plans load, the purchase runs, success lands, the app unlocks.

Success, failure or empty outcome view with one shared choreography: a ring, a solid block, an ink mark and one liquid glass action. The action is a signal-tinted glass capsule. While a retry runs, its label morphs to "Retrying" and it gives up a little of its width to a progress bubble that buds out of its trailing end and rests joined to it by a liquid neck; when the retry returns, the bubble melts back in and the capsule takes its width back.

Notes

  • Three outcomes share one choreography, a stamp landing: a ring is drawn in ink, color pools inward from it once it closes and the ring takes the block's color (sage for .success, butter for .failure, sky for .empty), then the mark is pressed in. The outcome lands on one beat: its haptic, a small thud of the block and one ripple. The headline and message rise together, and the actions follow a beat behind, landing with a little give. Change the view's .id to replay it from the start.
  • Passing a new outcome to the same view restamps in place instead of swapping: the old mark lifts as the block recolors, the new mark is pressed in, and the new outcome lands with its own haptic. The copy and actions crossfade and reflow together, and the action's label morphs letter by letter to its new title. A view that reappears keeps its landed outcome and plays nothing again.
  • .empty draws an open tray and plays a light impact, for first-run and no-results states.
  • The headline is set large and tight at .largeTitle; eyebrow adds a small uppercase line above it. Every string is semibold, so size and color carry the hierarchy.
  • The primary action is a liquid glass capsule tinted with signal (the brand red, #FF0000, by default) under dark ink. It sinks a few points while pressed and springs back with a little give. secondary is a quiet text button.
  • On failure, retry turns the primary action into "Try again". Tapping it morphs the label to "Retrying" while a round glass bubble with a spinner buds out of the button's trailing end: born inside the end, it springs out on a liquid neck as the button gives up its width, and rests joined to it. When the work returns, the bubble melts back in on a spring with no bounce and the button takes its width back.
  • details adds a glass panel, apart from the button, that opens to selectable monospaced text and closes a little quicker than it opens.
  • Style holds the three blocks, the ink, the signal tint and its ink, the text colors and the details panel's glass tint (raised, clear by default), with house palette defaults that adapt to light and dark. accent still overrides the block.
  • Before iOS 26 the button, bubble and panel draw on a frosted material with a light rim, and the bubble sits beside the button without a neck. Under Reduce Transparency they are solid.
  • Under Reduce Motion the stamp fades in whole instead of being drawn, then lands with its haptic, and the copy and actions fade in a beat later without rising. A restamp recolors the block and swaps the mark briefly, with no thud or ripple. The label crossfades, the progress bubble fades in and out beside the button, the pressed button shifts a shade instead of sinking (darker in light mode, lighter in dark), and the details fade open.
  • For a complete purchase screen, see the Pro Purchase screen.

Usage

OutcomeScreenExample()

Parameters

ParameterDescription
outcome.success, .failure or .empty. Sets the block, mark, and haptic.
titleHeadline, set large and tight.
messageSupporting copy.
primaryTitlePrimary button title when retry is not used.
primaryActionPrimary button handler when retry is not used.
retryOptional async handler for failures; the primary button becomes "Try again", and until it returns the label reads "Retrying" with a progress bubble budded out of the button's end.
secondaryOptional quiet second action.
detailsOptional technical text behind a "Details" disclosure on failures, on a glass panel.
accentOverrides the block color behind the mark. Defaults to the outcome's color in style.
eyebrowOptional small uppercase line above the title, such as "Synced 10:42".
styleBlock, signal and text colors. .standard is sage for success, butter for failure and sky for empty, with the brand red tinting the primary button's glass.

Install

Pick one. Run it from the folder that contains your .xcodeproj and the files land inside your app.

Terminal

$npx swiftpieces add OutcomeScreen

Or ask your coding agent · Claude Code, Cursor or Xcode, once the MCP server is connected

>Add the SwiftPieces "Outcome Screen" piece to my app

Or copy the source above into your app.

New to SwiftUI?If you know React, CSS or Tailwind, SwiftUI is easier to pick up than it looks.Try real app patterns first

Building a whole app? See SwiftPieces Pro →

All feedback →

Build it yourself: SwiftUI loading states guide · SwiftUI haptics guide

On this page

SwiftPiecesPro

Build the whole app with one library.

Production-ready screens, whole flows, complete app templates, a Build Kit your agent follows and Pro remixing.

54 screens · 46 patterns · 48 flows · 12 templates · 31 Build Kit skills

Explore Pro