Try this
Swift 4
let wholeStr = "Don't have an account? Register"
//let rangeToUnderLine = (wholeStr as NSString).range(of: "Register")
let rangeToUnderLine = NSRange(location: 0, length: 10))
let underLineTxt = NSMutableAttributedString(string: wholeStr, attributes: [NSAttributedStringKey.font:UIFont.systemFont(ofSize: 20),NSAttributedStringKey.foregroundColor: UIColor.white.withAlphaComponent(0.8)])
underLineTxt.addAttribute(NSAttributedStringKey.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue, range: rangeToUnderLine)
labelTc.attributedText = underLineTxt
Swift 3.2
let wholeStr = "Don't have an account? Register"
//let rangeToUnderLine = (wholeStr as NSString).range(of: "Register")
let rangeToUnderLine = NSRange(location: 0, length: 10))
let underLineTxt = NSMutableAttributedString(string: wholeStr, attributes: [NSFontAttributeName:UIFont.systemFont(ofSize: 20),NSForegroundColorAttributeName: UIColor.white])
underLineTxt.addAttribute(NSUnderlineStyleAttributeName, value: NSUnderlineStyle.styleSingle.rawValue, range: rangeToUnderLine)
labelTc.attributedText = underLineTxt
