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

Media Row

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

A media row with a thumbnail, title and meta.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

MediaRow.swift
// Media Row · syxUI · https://syxui.dev/components/list-media
// 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)
    }
}

// Media list row
struct MediaRow: View {
    var body: some View {
        HStack(spacing: 12) {
            Image("photo_travel").resizable().scaledToFill().frame(width: 72, height: 54).clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
            VStack(alignment: .leading, spacing: 3) { Text("Exploring the Greek Isles").font(.system(size: 15, weight: .medium)).lineLimit(1); HStack(spacing: 6) { Image(systemName: "clock").font(.system(size: 11)); Text("12:04 · 48K views").font(.system(size: 12)) }.foregroundStyle(.secondary) }
            Spacer()
            Image(systemName: "ellipsis").foregroundStyle(.secondary)
        }.formaCard(14).frame(width: 340)
    }
}
iOS 17 · 1 dependencies

Dependencies

SwiftUI
  • photo_travel (image asset)

Requires iOS 17