EasyText is library written in Swift, which provide an easy and safe way to create a NSAttributedString
.It use StringInterpolation
in Swift 5.
- Type safe
- Support multiple platfoms, iOS and macOS
- Support most of
NSAttributedString.Key
- Support usual operators, such as
+
,+=
- Support
UIImage
/NSImage
let text:EasyText = "\("font is 30 pt and color is yellow", .font(.systemFont(ofSize: 20)), .color(.blue))"
textView.attributedText = text.attributedString
More examples in Example/iOS.
-
iOS 9.0+/macOS 10.11+
-
Swift 5.0+
pod 'EasyText','~> 1.0.0'
github "Nemocdz/EasyText" "1.0.0"
dependencies: [
.package(url: "https://github.com/Nemocdz/EasyText.git", from: "1.0.0")
]
使用 Swift 5 字符串插值快速构建 AttributeString
Nemocdz, [email protected]
EasyText is available under the MIT license. See the LICENSE file for more info.