Contents

init(verbatim:)

Creates a text view that displays a string literal without localization.

Declaration

init(verbatim content: String)

Parameters

  • content:

    A string to display without localization.

Discussion

Use this initializer to create a text view with a string literal without performing localization:

Text(verbatim: "pencil") // Displays the string "pencil" in any locale.

If you want to localize a string literal before displaying it, use the init(_:tableName:bundle:comment:) initializer instead. If you want to display a string variable, use the init(_:) initializer, which also bypasses localization.

See Also

Creating a text view