https://github.com/carson-katri/attributedstringbuilder
A DSL for creating NSAttributedStrings
https://github.com/carson-katri/attributedstringbuilder
functionbuilder nsattributedstring swift5-1
Last synced: 6 months ago
JSON representation
A DSL for creating NSAttributedStrings
- Host: GitHub
- URL: https://github.com/carson-katri/attributedstringbuilder
- Owner: carson-katri
- Created: 2019-07-27T16:09:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-27T16:11:20.000Z (over 6 years ago)
- Last Synced: 2025-06-25T16:03:29.835Z (7 months ago)
- Topics: functionbuilder, nsattributedstring, swift5-1
- Language: Swift
- Size: 3.91 KB
- Stars: 24
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AttributedStringBuilder
A DSL for creating an `NSAttributedString`. Original created to demonstrate function builders [here](https://medium.com/@carson.katri/create-your-first-function-builder-in-5-minutes-b4a717390671).
Example:
```swift
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.