Contents

init(_:action:)

Creates a button that generates its label from a localized string resource.

Declaration

@preconcurrency @export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, action: @escaping @MainActor () -> Void)

Parameters

  • titleResource:

    Text resource for the button’s localized title, that describes the purpose of the button’s action.

  • action:

    The action to perform when the user triggers the button.

Discussion

This initializer creates a Text view on your behalf. See Text for more information about localizing strings.

See Also

Creating a button