AttributedText
AttributedText is a Swift µpackage that provides NSAttributedString
rendering in SwiftUI by wrapping either an NSTextView
or a UITextView
depending on the platform.
Supported Platforms
- macOS 11.0+
- iOS 14.0+
- tvOS 14.0+
Usage
An AttributedText
view takes all the available width and adjusts its height to fit the contents.
To change the text alignment or line break mode, you need to add a .paragraphStyle
attribute to the attributed string.
Installation
You can add AttributedText to an Xcode project by adding it as a package dependency.
- From the File menu, select Swift Packages › Add Package Dependency…
- Enter
https://github.com/gonzalezreal/AttributedText
into the package repository URL text field - Link AttributedText to your application target