I have a UITextView
and using NSRegularExpression
. I'm finding names in my text view. So I'm able to highlight matches using this code:
for match in matches as [NSTextCheckingResult] {
let matchRange = match.range
attributedText.addAttribute(NSStrokeColorAttributeName, value: UIColor.blueColor(), range: matchRange)
}
I want to make it clickable and pass its text to a new view controller. Or maybe change it to a UIButton
with the same text and add a segue to the new view controller. I'm not sure how to do it correctly.