So, in my awakeFromNib method of a UILabel subclass I have:
let termsArg = "Terms & Conditions"
self.linkText = termsArg
let exampleText = String(format:"By signing up you agree to our %@ and Privacy Policy", termsArg)
let underlinedAttributedString = NSMutableAttributedString(string: exampleText)
self.linkTextRange = (exampleText as NSString).range(of: termsArg)
let attributes = [NSAttributedStringKey.underlineStyle : NSUnderlineStyle.styleSingle]
underlinedAttributedString.addAttributes(attributes, range: self.linkTextRange)
self.attributedText = underlinedAttributedString
But, the line where I add these attributes ends up causing a hard crash where only the following is spit out to the console:
-[_SwiftValue _getValue:forType:]: unrecognized selector sent to instance 0x60c00005e510
I'm wondering what's gone wrong, because it appears that I've done everything right.