Advent · Day 21
This one opens on December 21.
Every door opens at midnight Pacific.
See the calendarPattern · 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.
| Price | $199 once |
|---|---|
| iOS | iOS 17.0 and later |
| License | A 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. |
| Dependencies | No third-party packages. Apple frameworks only. |
| Files | 1 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
$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
WishlistHeartfor 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
WishlistItemhas anid,title, optionalstore,priceandpreviousPrice(Decimal), thegroupIDit's in, an optionalimageURL, an SF Symbol and themetileindex for the placeholder, andclaimedByfor friends' lists.hasPriceDropis true whenpreviousPriceis aboveprice. - Price drops: keep the price a piece was saved at in
previousPriceand updatepricefrom 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.priceAlertsis 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 inaction.WishlistBlock.Shareis the list'surl, ahidesClaimedbinding and an optionalpriceAlertsbinding. Nil hides Share. Copy puts the link on the pasteboard; Share Link usesShareLink.onOpengets the tapped item, to push its page.onClaimisasync throws: record the claim on your server and setclaimedByon the item. A thrown error'serrorDescription, 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.
WishlistBlockExampleat the end ofWishlistBlock.swiftis 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
SPThemefrom@Environment(\.spTheme)and requires thedesign-systemitem. - The title is the display face at 28 points, capped at bold, with
type.tracking(for:); rows usetype.bodysemibold overtype.footnoteintextSecondary, prices with monospaced digits. - Rows are
color.surfacewithradius.lg; picture tiles usecolor.tile(_:)withradius.md; group chips arefillcapsules that turnaccentwithaccentOnwhen 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 istextTertiary, struck through. - Moves use
motion.smooth, chips and pressesmotion.snappyandmotion.standard.
Requirements
- None.
03
Keep building
Pieces that work well next to this one.