File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 11Pod ::Spec . new do |s |
22
33s . name = "AttributedString"
4- s . version = "3.0.1 "
4+ s . version = "3.1.0 "
55s . summary = "基于Swift字符串插值快速构建你想要的富文本, 支持点击按住等事件获取, 支持多种类型过滤"
66
77s . homepage = "https://github.com/lixiang1994/AttributedString"
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ public typealias Font = UIFont
2424#endif
2525
2626public struct ASAttributedString {
27+
2728 internal init ( value: NSAttributedString ) {
2829 self . value = value
2930 }
@@ -204,6 +205,29 @@ extension ASAttributedString {
204205 }
205206}
206207
208+ extension ASAttributedString {
209+
210+ public func add( attributes: Attribute ... , range: NSRange ? = . none) -> Self {
211+ return add ( attributes, range: range ?? . init( location: 0 , length: length) )
212+ }
213+
214+ public func add( _ attributes: [ Attribute ] , range: NSRange ) -> Self {
215+ var temp = self
216+ temp. add ( attributes: attributes, range: range)
217+ return temp
218+ }
219+
220+ public func set( attributes: Attribute ... , range: NSRange ? = . none) -> Self {
221+ return set ( attributes, range: range ?? . init( location: 0 , length: length) )
222+ }
223+
224+ public func set( _ attributes: [ Attribute ] , range: NSRange ) -> Self {
225+ var temp = self
226+ temp. set ( attributes: attributes, range: range)
227+ return temp
228+ }
229+ }
230+
207231fileprivate extension Dictionary where Key == NSAttributedString . Key , Value == Any {
208232
209233 static func == ( lhs: [ NSAttributedString . Key : Any ] , rhs: [ NSAttributedString . Key : Any ] ) -> Bool {
You can’t perform that action at this time.
0 commit comments