Contents

init(_:role:intent:)

Creates a button with a specified role that performs an AppIntent and generates its label from a string.

Declaration

nonisolated init(_ title: some StringProtocol, role: ButtonRole?, intent: some AppIntent)

Parameters

  • title:

    A string that describes the purpose of the button’s intent.

  • role:

    An optional semantic role describing the button. A value of nil means that the button doesn’t have an assigned role.

  • intent:

    The AppIntent to execute.

Discussion

This initializer creates a Text view on your behalf, and treats the title similar to init(_:). See Text for more information about localizing strings.

See Also

Creating a button to perform an App Intent