SkillAgentSearch skills...

NSAttributedStringBuilder

A micro-framework that exposes a function builder to compose attributed strings

Install / Use

/learn @vincent-pradeilles/NSAttributedStringBuilder
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

NSAttributedStringBuilder

platforms pod Carthage compatible

Context

NSAttributedStringBuilder is a Swift micro framework that leverages Function Builders to implement syntactic sugar that lets you intuitively compose attributed strings.

Instead of writing:

let attributedString = NSMutableAttributedString(string: "Hello", attributes: [.font: UIFont.systemFont(ofSize: 24), .foregroundColor: UIColor.red])
attributedString(NSAttributedString(string: " world!", attributes: [.font: UIFont.systemFont(ofSize: 20), .foregroundColor: UIColor.orange]))

You can now write:

let attributedString = NSAttributedString.composing {
    NSAttributedString(string: "Hello", attributes: [.font: UIFont.systemFont(ofSize: 24), .foregroundColor: UIColor.red])
    NSAttributedString(string: " world!", attributes: [.font: UIFont.systemFont(ofSize: 20), .foregroundColor: UIColor.orange])
}

Requirements

Xcode 11+ & Swift 5.1

Installation

CocoaPods

Add the following to your Podfile:

pod "NSAttributedStringBuilder"

Carthage

Add the following to your Cartfile:

github "vincent-pradeilles/NSAttributedStringBuilder"

Author

View on GitHub
GitHub Stars8
CategoryDevelopment
Updated6y ago
Forks0

Languages

Swift

Security Score

70/100

Audited on Oct 15, 2019

No findings