How to use NSUnderlineStyle.PatternDot

You have to do it like this:

Xcode 10 • Swift 4.2 or later

yourLabel.attributedText = NSAttributedString(string: "Hello World !!!", attributes: [.underlineStyle: NSUnderlineStyle.patternDot.union(.single).rawValue])

Note: for older Swift syntax check edit history

Leave a Comment