Docs
Controls

Slide to PayNew

A slide-to-confirm track whose house aura gathers under your thumb, then floods the track as it folds into a red check.

By

Slide to Pay: SwiftUI Slide to Pay Button for iOS, live preview in light mode

Slide to Pay, a SwiftUI Slide to Pay Button for iOS 17+, in its live preview. Open Code for the Swift source.

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

Colors for SlideToPay. .standard is the house palette.

Notes

  • Drag the thumb to the end to confirm. A soft house aura gathers under your thumb and follows it, growing brighter the further you go.
  • Let go before the end and the thumb springs back with the speed you released it at, and the light drains back with it. A quick flick near the end counts.
  • At the end the light floods the whole track, the track folds into a red check and a soft ring of light lets go, with a success haptic. action runs once.
  • isComplete stays true while it is folded. Set it back to false to unfold the track, for example if the payment fails.
  • It fills the width you give it and is 60pt tall, with a 48pt thumb.
  • VoiceOver reads it as a button and confirms with a double tap.
  • Under Reduce Motion the light holds still and still follows the thumb, and there is no ring. Under Reduce Transparency the aura becomes a plain red edge.

Usage

SlideToPayExample()

Install

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

Terminal

$npx swiftpieces add SlideToPay

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

>Add the SwiftPieces "Slide to Pay" 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 buttons and controls →

Build it yourself: SwiftUI motion guide · SwiftUI buttons 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.

Explore Pro