Contents

CardSnippetContext

A type that stores information about how to render a card snippet.

Declaration

struct CardSnippetContext

Overview

The CardSnippetContext type stores information that you use to render the views of a card snippet. When you create a CardSnippet for your entity, you specify a closure that accepts an instance of this type as a parameter. When the system needs to render a specific instance of your entity type, it passes the entity and a CardSnippetContext object to your closure. The context object contains information about the rendering environment, and you use this information to adjust your view-creation code.

The CardSnippetContext type contains only information that’s specific to card snippets. During rendering, use SwiftUI environment values to adjust your rendering code. For example, you might retrieve the current color scheme and locale from the colorScheme and locale environment values. For more information about how to use SwiftUI environment values, see EnvironmentValues.

Topics

Getting the environment details

See Also

Card snippets