Skip to content
Product Row preview
Rendered from the SwiftUI source on this page.

Product Row

From syxUI — written for both platforms, not translated between them.

A cart product row with a quantity stepper.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

ProductRow.swift
// Product Row · syxUI · https://syxui.dev/components/list-product
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

extension View {
    func formaCard(_ pad: CGFloat = 18) -> some View {
        self.padding(pad)
            .background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 20, style: .continuous))
            .overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).stroke(Color.primary.opacity(0.06), lineWidth: 1))
            .shadow(color: .black.opacity(0.05), radius: 14, x: 0, y: 6)
    }
}

// Product row with stepper
struct ProductRow: View {
    @State private var qty = 2
    var body: some View {
        HStack(spacing: 12) {
            Image("photo_product").resizable().scaledToFill().frame(width: 60, height: 60).clipShape(RoundedRectangle(cornerRadius: 10, style: .continuous))
            VStack(alignment: .leading, spacing: 3) { Text("Air Zoom Pegasus").font(.system(size: 15, weight: .medium)); Text("$129.00").font(.system(size: 14, weight: .semibold)) }
            Spacer()
            HStack(spacing: 12) { Image(systemName: "minus").font(.system(size: 12, weight: .bold)); Text("\(qty)").font(.system(size: 14, weight: .semibold)).frame(minWidth: 16); Image(systemName: "plus").font(.system(size: 12, weight: .bold)) }.padding(.horizontal, 10).padding(.vertical, 7).background(Color.primary.opacity(0.05), in: Capsule())
        }.formaCard(14).frame(width: 340)
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • photo_product (image asset)

Requires iOS 17