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 1
1
Pod ::Spec . new do |s |
2
2
3
3
s . name = "AttributedString"
4
- s . version = "3.0.1 "
4
+ s . version = "3.1.0 "
5
5
s . summary = "基于Swift字符串插值快速构建你想要的富文本, 支持点击按住等事件获取, 支持多种类型过滤"
6
6
7
7
s . homepage = "https://github.com/lixiang1994/AttributedString"
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ public typealias Font = UIFont
24
24
#endif
25
25
26
26
public struct ASAttributedString {
27
+
27
28
internal init ( value: NSAttributedString ) {
28
29
self . value = value
29
30
}
@@ -204,6 +205,29 @@ extension ASAttributedString {
204
205
}
205
206
}
206
207
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
+
207
231
fileprivate extension Dictionary where Key == NSAttributedString . Key , Value == Any {
208
232
209
233
static func == ( lhs: [ NSAttributedString . Key : Any ] , rhs: [ NSAttributedString . Key : Any ] ) -> Bool {
You can’t perform that action at this time.
0 commit comments