help

Adds help text to a view using a localized string resource that you provide.

View ModifieriOS 16.0+macOS 13.0+tvOS 16.0+watchOS 9.0+help(_:) in SwiftUI

Declaration

React
compose().help(textKey: string)
Swift
@export(implementation) nonisolated func help(
    _ textKey: LocalizedStringResource
) -> some View
3 more Swift overloads share this form
Swift
nonisolated func help(_ textKey: LocalizedStringKey) -> some View
Swift
nonisolated func help(_ text: Text) -> some View
Swift
nonisolated func help<S>(
    _ text: S
) -> some View
where S : StringProtocol

Parameters

  • textKey*string

    Text resource for the localized text to use as help.

Discussion

Adding help to a view configures the view's accessibility hint and its help tag (also called a tooltip) in macOS or visionOS. For more information on using help tags, see doc://com.apple.documentation/design/human-interface-guidelines/offering-help in the Human Interface Guidelines.

Button(action: composeMessage) {
    Image(systemName: "square.and.pencil")
}
.help("Compose a new message")

See also

More in Input and interaction.