Repository Public MIT
1import SwiftUI2import SPGlassKit34public struct GlassCardExample: GlassExample {5 public static let componentID = "glass-card"6 @State private var openCount = 078 public init() {}910 public var body: some View {11 ScrollView {12 VStack(alignment: .leading, spacing: 16) {13 GlassCard("Monthly rent") {14 Text("1,450 $").font(.title2)15 Text("Sample listing · 4½ · Plateau").foregroundStyle(.secondary)16 }17 GlassCard {18 Text("A long description wraps on several lines and stays readable because the card is opaque: dense text never sits on glass.")19 } header: {20 Label("About this place", systemImage: "text.alignleft")21 } footer: {22 Text("Fictitious data")23 }24 GlassCard(style: .floating, action: { openCount += 1 }) {25 Label("3 listings nearby", systemImage: "mappin.and.ellipse")26 Text("Opened \(openCount) times").font(.caption)27 }28 .accessibilityHint("Opens the list")29 }30 .padding()31 }32 }33}3435#Preview("GlassCard") { GlassCardExample().glassTheme(.ocean) }36