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

Shimmer Card

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

A skeleton card with a shimmer highlight.

Loaders · SwiftUI · iOS 17

  • loaders
  • swiftui

The actual source

ShimmerCard.swift
// Shimmer Card · syxUI · https://syxui.dev/components/loader-shimmer
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

func sk(_ w: CGFloat, _ h: CGFloat) -> some View { RoundedRectangle(cornerRadius: 5, style: .continuous).fill(Color.primary.opacity(0.08)).frame(width: w, height: h) }

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)
    }
}

struct ShimmerCard: View { var body: some View { VStack(alignment: .leading, spacing: 12) { RoundedRectangle(cornerRadius: 12, style: .continuous).fill(Color.primary.opacity(0.08)).frame(height: 120).overlay { LinearGradient(colors: [.clear, .white.opacity(0.55), .clear], startPoint: .leading, endPoint: .trailing).frame(width: 80).blur(radius: 8).offset(x: -30) }.clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous)); sk(200, 13); sk(140, 11) }.formaCard().frame(width: 280) } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17