textView(_:shouldInteractWith:in:interaction:)
Asks the delegate whether the specified text view allows the specified type of user interaction with the specified URL in the specified range of text.
Declaration
optional func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> BoolParameters
- textView:
The text view containing the text attachment.
- URL:
The URL to be processed.
- characterRange:
The character range containing the URL.
- interaction:
The type of interaction that is occurring (for possible values, see Uitextiteminteraction).
Return Value
true if interaction with the URL should be allowed; false if interaction should not be allowed.
Discussion
This method is called on only the first interaction with the URL link. For example, this method is called when the user wants their first interaction with a URL to display a list of actions they can take; if the user chooses an open action from the list, this method is not called, because “open” represents the second interaction with the same URL.