<!--
{
  "availability" : [
    "iOS: 27.3.0 -",
    "iPadOS: 27.3.0 -",
    "macCatalyst: -",
    "macOS: 27.3.0 -",
    "tvOS: 27.3.0 -",
    "visionOS: 27.3.0 -",
    "watchOS: 27.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/CardSnippet/init(supportedFamilies:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "App Intents",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:19_AppIntents_SwiftUI11CardSnippetV17supportedFamilies7contentACyxq_GSayAA0eF6FamilyVG_q_x_AA0eF7ContextVtScMYcctcfc"
  },
  "title" : "init(supportedFamilies:content:)"
}
-->

# init(supportedFamilies:content:)

Creates a card snippet with the views for specific families of content.

```
init(supportedFamilies: [CardSnippetFamily], @ViewBuilder content: @escaping @MainActor (Entity, CardSnippetContext) -> Content)
```

## Parameters

`supportedFamilies`

The families the card supports. Each family represents the intended context and
amount of space available for your custom views. For example, specify[`standard`](/documentation/AppIntents/CardSnippetFamily/standard) if your
views are suitable for display on iPhone. If you don’t support the family the system needs, the system presents
your entity using content from its display representation instead.

`content`

The view builder to create your view. The closure for the view builder takes the following parameters:

- `entity`: An instance of your [`AppEntity`](/documentation/AppIntents/AppEntity) type.
- `context`: A [`CardSnippetContext`](/documentation/AppIntents/CardSnippetContext) instance with information about the rendering environment.
  Combine the information in this instance with other SwiftUI environment variables to render your
  content. For example, get the current color scheme and locale from the SwiftUI environment values.

## Discussion

The builder can adapt the layout based on the rendering family from the card snippet context.

```swift
CardSnippet(supportedFamilies: [.standard]) { recipe, context in
   switch context.family {
       case .standard:
            LargeRecipeCardView(recipe: recipe)
        default:
            RecipeCardView(recipe: recipe)
    }
}
```

Use this initializer to deliver a SwiftUI view with the visual representation of your entity. Create your
view primarily with static content such as text and images. The system renders snippets in advance and
stores your views in a static archive it can use at any time, including when your app isn’t running, so
you can’t change the content of your view later. If your view requires data that isn’t immediately available,
prepare the data before you return the SwiftUI view from your closure. For example, if you need to create
custom images, create them before you return your view. Prepare data synchronously
to ensure it’s available when you create your view. If you generate data asynchronously, it likely won’t
be available in time.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)