Swiftpack.co - carson-katri/AttributedStringBuilder as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by carson-katri.
carson-katri/AttributedStringBuilder 1.0.0
A DSL for creating NSAttributedStrings
⭐️ 25
🕓 4 years ago
.package(url: "https://github.com/carson-katri/AttributedStringBuilder.git", from: "1.0.0")

AttributedStringBuilder

A DSL for creating an NSAttributedString. Original created to demonstrate function builders here.

Example:

NSAttributedString {
  "Hello "
    .foregroundColor(.blue)
  "World"
    .background(.orange)
    .underline(.red, style: .thick)
}

Installation

You can install it via the Swift Package Manager in Xcode 11.

Go to File > Swift Packages > Add Package Dependency...

In the text field paste the following: https://github.com/carson-katri/AttributedStringBuilder.

Documentation

Available modifiers:

  • foregroundColor
  • background
  • underline
  • font
  • shadow

Feel free to add any that're missing.

GitHub

link
Stars: 25
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics