Skip to content
Video Card preview
Rendered from the SwiftUI source on this page.

Video Card

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

A video card with channel avatar, title and views.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

VideoCard2.swift
// Video Card · syxUI · https://syxui.dev/components/media2-video-card
// 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)
    }
}

// Video card with channel
struct VideoCard2: View {
    var body: some View {
        VStack(alignment: .leading, spacing: 10) {
            Image("photo_pet").resizable().scaledToFill().frame(height: 160).frame(maxWidth: .infinity).clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous)).overlay(alignment: .bottomTrailing) { Text("12:04").font(.system(size: 11, weight: .semibold)).foregroundStyle(.white).padding(.horizontal, 6).padding(.vertical, 2).background(.black.opacity(0.7), in: RoundedRectangle(cornerRadius: 5)).padding(8) }
            HStack(alignment: .top, spacing: 10) {
                Image("person_2").resizable().scaledToFill().frame(width: 36, height: 36).clipShape(Circle())
                VStack(alignment: .leading, spacing: 2) {
                    Text("Training your puppy in 10 minutes a day").font(.system(size: 14, weight: .semibold)).lineLimit(2)
                    Text("Pet Academy · 248K views · 2d").font(.system(size: 12)).foregroundStyle(.secondary)
                }
                Image(systemName: "ellipsis").foregroundStyle(.secondary)
            }
        }.formaCard(14).frame(width: 320)
    }
}
iOS 17 · 2 dependencies

Dependencies

SwiftUI
  • person_2 (image asset)
  • photo_pet (image asset)

Requires iOS 17