I\'ve got a TextField
with a numberPad
and the function runs only if it contains numbers.
The user will crash the app if they paste letters
I did use this code. This is working.
override func canPerformAction(_ action: Selector, withSender sender: Any?) Bool {
if YOURTEXTFIELD.isFirstResponder {
DispatchQueue.main.async(execute: {
(sender as? UIMenuController)?.setMenuVisible(false, animated: false)
})
return false
}
return super.canPerformAction(action, withSender: sender)
}