What is primaryActionTriggered event

What is exactly the "primary Action Triggered" event for a UITextField ?

It seems to be close to an Editing did End ?


The documentation is a bit limited :

static var primaryActionTriggered: UIControlEvents

A semantic action triggered by buttons.

Accepted Reply

This seems to be the explanation. "Primary event" for UITextField is "return hit".


Good explanation here : h ttps://scholar.flatworldknowledge.com/books/30938/programming_2-30954-20170903-183235-040537/preview


Dismissing the Keyboard: The First Responder and the Text Field “Primary Action Triggered” Event

When a user taps a text field on an iOS device, the keyboard is automatically displayed, the cursor inside the text field becomes active, and that text field becomes what is known as the first responder. The first responder is the interface object, which first receives certain events, including keyboard events, motion events, and action messages, among others. A first responder won’t prevent touch and multitouch events, which go directly to the view that the user touches. This lets you still click buttons on the screen, even when the keyboard is shown.

In order to hide the keyboard, an app must call the .resignFirstResponder() method from the object that is currently the first responder (e.g., the text field that the user tapped). This method is often called when the user presses the “Return” key.


Settings for creating a text field @IBAction, triggered when the Return key is pressed (event type “Primary Action Triggered”).


To create an event that responds to the “Return Key” being pressed, simply create an @IBAction by Control-dragging the text field into your .swift code. Specify the connection as “Action”, give the action (function) a name, the “Type” should be UITextField, and the “Event” should be “Primary Action Triggered” (the default “Primary Action” for a UITextField is the pressing of the “Return” key).

Replies

This seems to be the explanation. "Primary event" for UITextField is "return hit".


Good explanation here : h ttps://scholar.flatworldknowledge.com/books/30938/programming_2-30954-20170903-183235-040537/preview


Dismissing the Keyboard: The First Responder and the Text Field “Primary Action Triggered” Event

When a user taps a text field on an iOS device, the keyboard is automatically displayed, the cursor inside the text field becomes active, and that text field becomes what is known as the first responder. The first responder is the interface object, which first receives certain events, including keyboard events, motion events, and action messages, among others. A first responder won’t prevent touch and multitouch events, which go directly to the view that the user touches. This lets you still click buttons on the screen, even when the keyboard is shown.

In order to hide the keyboard, an app must call the .resignFirstResponder() method from the object that is currently the first responder (e.g., the text field that the user tapped). This method is often called when the user presses the “Return” key.


Settings for creating a text field @IBAction, triggered when the Return key is pressed (event type “Primary Action Triggered”).


To create an event that responds to the “Return Key” being pressed, simply create an @IBAction by Control-dragging the text field into your .swift code. Specify the connection as “Action”, give the action (function) a name, the “Type” should be UITextField, and the “Event” should be “Primary Action Triggered” (the default “Primary Action” for a UITextField is the pressing of the “Return” key).