Voice over doesn't detect links in UITextView (iOS 13)
I have below code which works fine for voice over on iOS 12 (i.e. Voice over selects individual links on swipe up/down) but on iOS 13 swipe up/down doesn't work
class ViewController: UIViewController {
@IBOutlet weak var myTextView: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
let text = "Testing https://www.google.com/ in link and 904-567-5678 is phone number"
let attributedString = NSMutableAttributedString(string: text)
myTextView.attributedText = attributedString
myTextView.isUserInteractionEnabled = false
myTextView.isEditable = false
myTextView.isSelectable = true
myTextView.dataDetectorTypes = [.link,.phoneNumber]
myTextView.font = UIFont(name: myTextView.font!.fontName,
size: 25.0)
myTextView.backgroundColor = .red
}
func textView(_ textView: UITextView,
shouldInteractWith URL: URL,
in characterRange: NSRange,
interaction: UITextItemInteraction) -> Bool {
UIApplication.shared.open(URL, options: [:])
return false
}
}