Skip to content

Commit

Permalink
Added convenience function to append attributed strings with color
Browse files Browse the repository at this point in the history
  • Loading branch information
charliescheer committed Sep 11, 2024
1 parent f686d1b commit 83cfbfb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Simplenote/NSMutableAttributedString+Simplenote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ extension NSMutableAttributedString {

/// Appends the specified String
///
func append(string: String) {
let string = NSAttributedString(string: string)
func append(string: String, foregroundColor: NSColor? = nil) {
var attributes = [NSAttributedString.Key: Any]()
if let foregroundColor = foregroundColor {
attributes[.foregroundColor] = foregroundColor
}

let string = NSAttributedString(string: string, attributes: attributes)
append(string)
}

Expand Down

0 comments on commit 83cfbfb

Please sign in to comment.