Assign multiple attributes in one go rather than one at a time
This commit is contained in:
parent
df4ea1479a
commit
26415f0c62
@ -101,8 +101,13 @@ extension NSAttributedString {
|
|||||||
let descriptor = font.fontDescriptor.addingAttributes(attributes)
|
let descriptor = font.fontDescriptor.addingAttributes(attributes)
|
||||||
|
|
||||||
let newFont = Font(descriptor: descriptor, size: font.pointSize)
|
let newFont = Font(descriptor: descriptor, size: font.pointSize)
|
||||||
mutable.addAttribute(.font, value: newFont as Any, range: range)
|
|
||||||
mutable.addAttribute(superscriptAttribute, value: 0, range: range)
|
let newAttributes: [NSAttributedString.Key: Any] = [
|
||||||
|
.font: newFont as Any,
|
||||||
|
superscriptAttribute: 0,
|
||||||
|
]
|
||||||
|
|
||||||
|
mutable.addAttributes(newAttributes, range: range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user