Components/E-commerce/Product Detail
Product Detail

Product Detail

NFrom Nibware

A product detail block with photo, title, rating and price.

E-commerce · 38 lines · SwiftUI · iOS 17+

The actual source

ProductDetail.swift
import SwiftUI

let ecGold = Color(red: 0.98, green: 0.72, blue: 0.10)

func ecImage(_ name: String, _ w: CGFloat, _ h: CGFloat, _ r: CGFloat = 12) -> some View {
    Image(name).resizable().aspectRatio(contentMode: .fill).frame(width: w, height: h)
        .clipShape(RoundedRectangle(cornerRadius: r, style: .continuous))
}

func ecStars(_ rating: String, _ count: String) -> some View {
    HStack(spacing: 3) {
        Image(systemName: "star.fill").font(.system(size: 10)).foregroundStyle(ecGold)

Images this component uses

The code references this image by name. Download and drag into your Xcode Asset Catalog, keeping the same name, and the component renders exactly like the preview. Or swap in your own.

What it needs

Self-contained SwiftUI - system materials, SF Symbols, no external dependencies. Everything it needs - tokens, sub-views, models - is carried in the copy-paste source above.