Skip to main content

TextAttributes - An easier way to compose attributed strings

TextAttributes makes it easy to compose attributed strings.

let attrs = TextAttributes()
    .font(name: "HelveticaNeue", size: 16)
    .foregroundColor(white: 0.2, alpha: 1)
    .lineHeightMultiple(1.5)

NSAttributedString("The quick brown fox jumps over the lazy dog", attributes: attrs)

Features

  • Strongly typed properties
  • Chainable setter methods
  • A direct access to the NSParagraphStyle properties
  • Better autocompletion

Comments