import SwiftUI struct AISkeletonLine: View { let width: CGFloat? let height: CGFloat init(width: CGFloat? = nil, height: CGFloat) { self.width = width self.height = height } init(width fraction: CGFloat, height: CGFloat) { self.init(width: nil, height: height) self.fraction = fraction } private var fraction: CGFloat? var body: some View { Group { if let fraction { GeometryReader { proxy in Capsule(style: .continuous) .frame(width: max(0, proxy.size.width * fraction)) } } else if let width { Capsule(style: .continuous) .frame(width: width) } } .frame(height: height) .background(AISkeletonFill()) } } struct AISkeletonCard: View { let height: CGFloat var body: some View { RoundedRectangle(cornerRadius: 14, style: .continuous) .frame(height: height) .background(AISkeletonFill()) } } private struct AISkeletonFill: View { var body: some View { Rectangle() .fill(AITheme.control) } }