Advent · Day 21

This one opens on December 21.

Every door opens at midnight Pacific.

See the calendar

Pattern · Lists and Feeds

Wishlist SwiftUI Block

Wishlist SwiftUI Block is a paid SwiftUI pattern in SwiftPieces Pro. Saved pieces in groups you drag between, a red price-drop mark with the old price struck, and a share link that keeps claimed gifts a surprise. iOS 17.0 and later. SwiftPieces Pro is $199 once.

Saved pieces in groups you drag between, a red price-drop mark with the old price struck, and a share link that keeps claimed gifts a surprise.

Buyers also search for this as a SwiftUI section.

Facts
Price$199 once
iOSiOS 17.0 and later
LicenseA per-developer commercial license for unlimited personal and commercial apps, including client work. Do not resell or redistribute the source as a template or UI kit.
DependenciesNo third-party packages. Apple frameworks only.
Files1 Swift file in the install.

A wishlist section for a shop or gifting app. Rows carry a picture, the name, store, group and price, a heart that unsaves with Undo and a menu to move or remove; drag a row onto a group in the bar to move it there. When a price falls the row strikes the old one and marks the saving in red. Share opens the link with Hide what's claimed and price drop alerts, and the same block shows a friend's list with Claim when you pass `onClaim`.

  • SwiftUI
  • iOS 17.0+
  • wishlist
Get SwiftPieces Pro

$199 once, every piece included. See how installing works · Sign in

Proof

This targets iOS 17.0 and later. On iOS 26 it uses Liquid Glass. On iOS 17 through iOS 18 it uses a material fallback, including when Reduce Transparency is on.

No simulator still is published for this page yet.

01

What's included

SwiftUI source you own, built on Apple frameworks only.

  • Groups as a chip bar with counts: add, rename, delete, and drag rows onto them
  • A red price-drop mark with the old price struck and the saving
  • A heart that unsaves with Undo, and WishlistHeart for your product pages
  • A share sheet with the link, Hide what's claimed and price drop alerts
  • A friend's list mode with Claim and Taken, so nobody buys the same gift

Used in

Gift App (template)

02

Implementation notes

How it behaves, what it handles, and the decisions behind it.

The header carries the title with a count that rolls as pieces come and go, a red line when prices have dropped, and Share. Under it a bar of groups: All, then yours (Birthday, Home, Desk), each with how many it holds, and a plus that names a new one. A group's long-press menu renames or deletes it; deleting keeps its pieces, ungrouped. Each row is a picture (your URL, or an SF Symbol on a theme tile while it loads), the name, the store and group, and the price. When a price falls below the one you saved it at, the price turns red, the old one is struck under it and a red mark shows the saving. The heart unsaves the piece with Undo for five seconds, the menu moves it to another group or removes it, and a row dragged onto a group's chip moves there. Share opens a sheet with the link to copy, Hide what's claimed (on by default, so you never see what friends bought you), price drop alerts and the system share sheet. Pass onClaim and the same block shows a friend's list instead: rows offer Claim, show Taken once someone has it, and nothing can be edited.

Notes

  • WishlistBlock(items:groups:title:currencyCode:share:onOpen:onClaim:) binds [WishlistItem] and [WishlistGroup] and edits them in place when a piece moves, is removed, is restored, or a group is added, renamed or deleted. Persist the arrays however your app keeps data. It is a section: no navigation stack, background, padding or scroll view of its own.
  • A WishlistItem has an id, title, optional store, price and previousPrice (Decimal), the groupID it's in, an optional imageURL, an SF Symbol and theme tile index for the placeholder, and claimedBy for friends' lists. hasPriceDrop is true when previousPrice is above price.
  • Price drops: keep the price a piece was saved at in previousPrice and update price from your catalog or a price check. The row marks the drop as soon as the new price arrives. Turn on alerts by scheduling a local notification when your check finds one; share.priceAlerts is the switch.
  • WishlistHeart(isSaved:action:) is the same heart for your product pages: it fills red and bounces with a light tap. Append the piece to your items in action.
  • WishlistBlock.Share is the list's url, a hidesClaimed binding and an optional priceAlerts binding. Nil hides Share. Copy puts the link on the pasteboard; Share Link uses ShareLink.
  • onOpen gets the tapped item, to push its page. onClaim is async throws: record the claim on your server and set claimedBy on the item. A thrown error's errorDescription, or "Couldn't claim it. Try again.", shows under the row.
  • Haptics: a selection tick when a piece moves group, a light tap on the heart, success when a claim goes through.
  • VoiceOver reads each row as its name, store, group and price ("$98, down from $129"), with Move to each other group and Remove as actions, so nothing needs dragging. Moves, removals and claims are announced.
  • Dynamic Type: names wrap to two lines and the price keeps its width; the group bar scrolls sideways.
  • Reduce Motion turns rows sliding in and out, the price-drop mark and the chip lift into short fades.
  • WishlistBlockExample at the end of WishlistBlock.swift is Maya's wishlist in Giftlist: five pieces in Birthday, Home and Desk, the pour-over down from $129 to $98, shared at giftlist.app with claimed gifts hidden.

Theming

  • Reads SPTheme from @Environment(\.spTheme) and requires the design-system item.
  • The title is the display face at 28 points, capped at bold, with type.tracking(for:); rows use type.body semibold over type.footnote in textSecondary, prices with monospaced digits.
  • Rows are color.surface with radius.lg; picture tiles use color.tile(_:) with radius.md; group chips are fill capsules that turn accent with accentOn when selected, and outline in the accent while a row is dragged over them.
  • The heart, the price-drop price, its mark and the price drop count are danger, the one red on the list. The old price is textTertiary, struck through.
  • Moves use motion.smooth, chips and presses motion.snappy and motion.standard.

Requirements

  • None.

03

Keep building

Pieces that work well next to this one.