Convert to an if-let since currentStyles are being stored instead of a single style

This commit is contained in:
Nate Weaver 2020-04-28 17:03:43 -05:00
parent 7f3b77b760
commit b7916f7d31
1 changed files with 2 additions and 4 deletions

View File

@ -172,12 +172,10 @@ extension NSAttributedString {
let location = lastRange != nil ? lastRange!.location + lastRange!.length : 0
let range = NSRange(location: location, length: result.mutableString.length - location)
let style = Style(tag: tag)
attributeRanges.append( (range: range, styles: currentStyles) )
if style != nil {
currentStyles.insert(style!)
if let style = Style(tag: tag) {
currentStyles.insert(style)
}
} else {
if tag == "q" {