Contents

IntentItemCollection

Return this object to provide an advanced list of options, optionally divided in sections.

Declaration

struct IntentItemCollection<Result> where Result : _IntentValue

Example

struct CreateBookIntent: AppIntent {
    @Parameter(title: "Author Name", optionsProvider: AuthorNamesOptionsProvider())
    var authorName: String

    struct AuthorNamesOptionsProvider: DynamicOptionsProvider {
        func results() async throws -> ItemCollection<Int> {
            ItemCollection {
                ItemSection("Italian Authors") {
                    "Dante Alighieri"
                    "Alessandro Manzoni"
                }
                ItemSection("Russian Authors") {
                    "Anton Chekhov"
                    "Fyodor Dostoevsky"
                }
            }
        }
    }
}

Topics

Initializers

Instance Properties

Type Properties

See Also

Items and collections