CardMedia

public struct CardMedia
extension CardMedia: View
extension CardMedia: _ViewEmptyChecking

CardMedia: Composite Component Protocol

The _CardMediaComponent protocol combines media image and description components for card layouts. This protocol provides a unified interface for displaying media content with descriptive text in card-based UI components.

Usage

This component is typically used as part of a larger card structure to display media content such as images, videos, or other visual elements along with descriptive text.

CardMedia {
    Image("card_image")
        .resizable()
        .aspectRatio(contentMode: .fill)
        .frame(height: 145)
} description: {
    Text("Media Description")
}
CardMedia(mediaImage: Image("sample-image"), description: "This is a sample media description")
  • Undocumented

    Declaration

    Swift

    public init(@ViewBuilder mediaImage: () -> any View = { EmptyView() },
                @ViewBuilder description: () -> any View = { EmptyView() },
                componentIdentifier: String? = CardMedia.identifier)
  • Undocumented

    Declaration

    Swift

    static let identifier: String
  • Undocumented

    Declaration

    Swift

    init(mediaImage: Image? = nil,
         description: AttributedString? = nil)
  • Undocumented

    Declaration

    Swift

    init(_ configuration: CardMediaConfiguration)
  • Declaration

    Swift

    @MainActor
    public var body: some View { get }
  • Undocumented

    Declaration

    Swift

    public var isEmpty: Bool { get }