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

Review Row

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

A review row with an avatar and star rating.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

RatingRow.swift
// Review Row · syxUI · https://syxui.dev/components/list-rating
// 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)
    }
}

// Row with star rating
struct RatingRow: View {
    var body: some View {
        HStack(spacing: 12) {
            Image("person_4").resizable().scaledToFill().frame(width: 44, height: 44).clipShape(Circle())
            VStack(alignment: .leading, spacing: 3) { Text("Arjun Patel").font(.system(size: 15, weight: .medium)); HStack(spacing: 2) { ForEach(0..<5, id: \.self) { i in Image(systemName: i < 4 ? "star.fill" : "star").font(.system(size: 11)).foregroundStyle(.orange) } } }
            Spacer()
            Text("2d ago").font(.system(size: 12)).foregroundStyle(.secondary)
        }.formaCard(14).frame(width: 320)
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • person_4 (image asset)

Requires iOS 17