Skip to content
Skeleton List preview
Rendered from the SwiftUI source on this page.

Skeleton List

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

A list-row skeleton.

Loaders · SwiftUI · iOS 17

  • loaders
  • swiftui

The actual source

SkeletonList.swift
// Skeleton List · syxUI · https://syxui.dev/components/loader-sk-list
// 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) }
func skC(_ d: CGFloat) -> some View { Circle().fill(Color.primary.opacity(0.08)).frame(width: d, height: d) }

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 SkeletonList: View { var body: some View { VStack(spacing: 16) { ForEach(0..<3, id: \.self) { _ in HStack(spacing: 12) { skC(48); VStack(alignment: .leading, spacing: 7) { sk(160, 13); sk(110, 11) }; Spacer() } } }.formaCard().frame(width: 300) } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17