Contents

init(_:systemImage:role:intent:)

Creates a button with a specified role that generates its label from a string and a system image.

Declaration

nonisolated init(_ title: some StringProtocol, systemImage: String, role: ButtonRole? = nil, intent: some AppIntent)

Parameters

  • title:

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

  • systemImage:

    The name of the image resource to lookup.

  • 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 Label 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