@@ -307,7 +307,10 @@ extension NSAttributedString {
307
307
open class NSMutableAttributedString : NSAttributedString {
308
308
309
309
open func replaceCharacters( in range: NSRange , with str: String ) { NSUnimplemented ( ) }
310
- open func setAttributes( _ attrs: [ NSAttributedStringKey : Any ] ? , range: NSRange ) { NSUnimplemented ( ) }
310
+
311
+ open func setAttributes( _ attrs: [ NSAttributedStringKey : Any ] ? , range: NSRange ) {
312
+ CFAttributedStringSetAttributes ( _cfMutableObject, CFRange ( range) , attrs? . _cfObject, true )
313
+ }
311
314
312
315
open var mutableString : NSMutableString {
313
316
return _string as! NSMutableString
@@ -317,9 +320,13 @@ open class NSMutableAttributedString : NSAttributedString {
317
320
CFAttributedStringSetAttribute ( _cfMutableObject, CFRange ( range) , name. rawValue. _cfObject, _SwiftValue. store ( value) )
318
321
}
319
322
320
- open func addAttributes( _ attrs: [ NSAttributedStringKey : Any ] , range: NSRange ) { NSUnimplemented ( ) }
323
+ open func addAttributes( _ attrs: [ NSAttributedStringKey : Any ] , range: NSRange ) {
324
+ CFAttributedStringSetAttributes ( _cfMutableObject, CFRange ( range) , attrs. _cfObject, false )
325
+ }
321
326
322
- open func removeAttribute( _ name: NSAttributedStringKey , range: NSRange ) { NSUnimplemented ( ) }
327
+ open func removeAttribute( _ name: NSAttributedStringKey , range: NSRange ) {
328
+ CFAttributedStringRemoveAttribute ( _cfMutableObject, CFRange ( range) , name. rawValue. _cfObject)
329
+ }
323
330
324
331
open func replaceCharacters( in range: NSRange , with attrString: NSAttributedString ) { NSUnimplemented ( ) }
325
332
open func insert( _ attrString: NSAttributedString , at loc: Int ) { NSUnimplemented ( ) }
0 commit comments