
Coupon Card
From syxUI — written for both platforms, not translated between them.
A promo coupon with a discount, a dashed code and expiry.
Cards · SwiftUI · iOS 17
- cards
- swiftui
The actual source
CouponCard.swift
// Coupon Card · syxUI · https://syxui.dev/components/card-coupon
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
// Coupon card
struct CouponCard: View {
let red = Color(red: 0.90, green: 0.24, blue: 0.28)
var body: some View {
HStack(spacing: 0) {
VStack(alignment: .leading, spacing: 4) {
Text("25% OFF").font(.system(size: 22, weight: .heavy)).foregroundStyle(red)
Text("Your first order").font(.system(size: 13)).foregroundStyle(.secondary)
}
Spacer()
VStack(spacing: 4) {
Text("SAVE25").font(.system(size: 14, weight: .bold)).foregroundStyle(.primary)
.padding(.horizontal, 12).padding(.vertical, 6)
.overlay(RoundedRectangle(cornerRadius: 8).stroke(style: StrokeStyle(lineWidth: 1.2, dash: [4, 3])).foregroundStyle(.secondary))
Text("Exp. Jul 31").font(.system(size: 11)).foregroundStyle(.secondary)
}
}
.padding(16).frame(width: 300)
.background(red.opacity(0.06), in: RoundedRectangle(cornerRadius: 16, style: .continuous))
.overlay(RoundedRectangle(cornerRadius: 16, style: .continuous).stroke(style: StrokeStyle(lineWidth: 1.5, dash: [7, 5])).foregroundStyle(red.opacity(0.35)))
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


