Docs
Inputs

Swatch PickerNew

A row of named color swatches whose selection ring flows to the one you tap, with a check in whichever ink reads on it.

$npx swiftpieces add SwatchPicker
Free · MIT + Commons ClauseiOS 17.0+colorpickerswatchtagsselectionhaptics
Type
SwatchPicker
Files
SwatchPicker.swift
Depends on
Nothing (Apple frameworks only)
Version
1.0.0

Colors for SwatchPicker. .standard is the house palette.

Notes

  • Each swatch is a named color, so VoiceOver reads the name ("Sky, selected") rather than a color value. SwatchPicker.house is the SwiftPieces red and five pastels; pass your own [Swatch] for a tag or theme palette.
  • The selection is a ring around the swatch. On a new pick the edge facing the new swatch leads on a tight spring and the far edge follows on a looser one, so the ring stretches into a capsule across the swatches between and gathers in around the new one.
  • A check pops into the picked swatch in ink or white, whichever reads on that color in the current appearance.
  • Swatches are 34pt by default, and the gap around each counts as part of it, so the tap target reaches 44pt. A row wider than its space scrolls sideways.
  • One selection haptic fires per pick. Setting selection from outside moves the ring the same way a tap does. .disabled(true) dims the row.
  • Under Reduce Motion the ring slides whole on one short spring and the check eases in without overshoot.

Usage

SwatchPickerExample()

Install

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

Terminal

$npx swiftpieces add SwatchPicker

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

>Add the SwiftPieces "Swatch Picker" 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 inputs and forms →

Build it yourself: 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