TextAttributes 提供简单易用的 API,用于为常见的 UIKit 组件设置文本属性。
TextAttributes 让您摆脱笨重的 NSAttributedString
API == 您无需记住 [NSAttributedStringKey: Any] 或其连续的字符串键 (.font
、.foregroundColor
、.kern
),而是可以直接专注于样式设置。
let textAttributes = TextAttributes.attributes(font: Font.normalRegular, color: Color.white)
label.textAttributes = textAttributes
button.setAttributes(textAttributes, for: .normal)
textView.textAttributes = textAttributes
添加源
source 'https://github.com/bielikb/TextAttributes.git'
pod 'TextAttributes', '~> 1.0.1'