/AttributedBuilder

Builder for NSAttributedString

Primary LanguageSwiftMIT LicenseMIT

AttributedBuilder

A builder-style wrapper for NSAttributedString.

Swift 5.0 Swift Package Manager Platforms GitHub issues

Requirements

  • iOS 9 (or macOS 10.10)
  • Swift 5.0

Example usage

The following example demonstrates creating an attributed string.

// Optional: Create an alias for NSAttributedString
typealias AttributedString = NSAttributedString

let value = AttributedString(string: "Hello, world!")
    .font(.largeTitle)
    .foregroundColor(.darkGray)
    .backgroundColor(.yellow)
    .lineSpacing(50)

Disclaimer

This package utilizes the UIKit or Cocoa framework (depending on platform), both of which are property of Apple Inc.

AttributedBuilder is an independent open source effort and has not been authorized, sponsored, or otherwise approved by Apple Inc.