TTBaseSUIShadowView
DisplayA SwiftUI container that wraps any content in a card with a RoundedRectangle background and shadow. Equivalent to the UIKit TTBaseShadowPanelView family but fully SwiftUI native.
🚀 Usage
// Basic shadow card
TTBaseSUIShadowView {
TTBaseSUIText(withType: .TITLE, text: "Card Content", align: .center, color: TTView.textDefColor.toColor())
.pAll(20)
}
.frame(maxWidth: .infinity)
// Custom colors and radius
TTBaseSUIShadowView(
viewDefBgColor: Color.white,
cornerRadius: 16,
shadowColor: Color.black.opacity(0.1),
shadowRadius: 6
) {
VStack(spacing: 12) {
TTBaseSUIText(withBold: .TITLE, text: "Product Name", align: .leading, color: TTView.textTitleColor.toColor())
TTBaseSUIText(withType: .SUB_TITLE, text: "$29.99", align: .leading, color: TTView.textSubTitleColor.toColor())
}
.pAll(TTSize.P_CONS_DEF)
}
// List of shadow cards
ScrollView {
LazyVStack(spacing: TTSize.P_CONS_DEF) {
ForEach(items) { item in
TTBaseSUIShadowView {
ItemRowView(item: item)
}
}
}
.pHorizontal(TTSize.P_CONS_DEF)
}
📖 Initializer
| Parameter | Default | Description |
|---|---|---|
viewDefBgColor | viewDefColor | Card background color |
cornerRadius | TTSize.CORNER_RADIUS | Rounded corner radius |
shadowColor | viewPanelShadowColor | Shadow tint color |
shadowRadius | 4.0 | Y-offset of shadow (radius is fixed at 8) |
content | Required | ViewBuilder content inside the card |
Pro Tip:
TTBaseSUIShadowView automatically applies .pAll(TTSize.P_S) inner padding. If you need larger padding, apply .pAll(x) to your content inside the builder, or override by adding .padding(0) then custom padding on the outer view.