Instance Method インスタンスメソッド

accessibilityAction(named:_:)

Adds an accessibility action to the view. Actions allow assistive technologies, such as the VoiceOver, to interact with the view by invoking the action.

Declaration 宣言

func accessibilityAction<S>(named name: S, _ handler: @escaping () -> Void) -> ModifiedContent<Self, AccessibilityAttachmentModifier> where S : StringProtocol

Discussion 議論

For example, this is how a custom action to compose a new email could be added to a view.


var body: some View {
    ContentView()
        .accessibilityAction(named: "New Message") {
            // Handle action
        }
}