Skip to content

Instantly share code, notes, and snippets.

@jeffbailey
Created May 30, 2015 11:02
Show Gist options
  • Select an option

  • Save jeffbailey/b5b8b0b60016516e05ed to your computer and use it in GitHub Desktop.

Select an option

Save jeffbailey/b5b8b0b60016516e05ed to your computer and use it in GitHub Desktop.

Revisions

  1. jeffbailey created this gist May 30, 2015.
    11 changes: 11 additions & 0 deletions WatchKit Hyphenated Text
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    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))
    }
    }