//you can add doted underline string like this in swift 5
let string = NSMutableAttributedString(string: "Hello string")
string.addAttributes([.underlineStyle : NSUnderlineStyle.single.union(.patternDot).rawValue],
range: NSRange(location: 0, length: string.length))
yourLableName.attributedText = string