Skip to content

Instantly share code, notes, and snippets.

@jeffbailey
Created May 30, 2015 11:02
Show Gist options
  • Save jeffbailey/b5b8b0b60016516e05ed to your computer and use it in GitHub Desktop.
Save jeffbailey/b5b8b0b60016516e05ed to your computer and use it in GitHub Desktop.
Thanks to http://radex.io/watch/hyphenation/?utm_campaign=iOS%2BDev%2BWeekly&utm_source=iOS_Dev_Weekly_Issue_200
extension WKInterfaceLabel {
func setHyphenatedText(text: String) {
let style = NSMutableParagraphStyle()
style.hyphenationFactor = 1
let attributes = [NSParagraphStyleAttributeName: style]
setAttributedText(NSAttributedString(string: text, attributes: attributes))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment