I want to append an Attributed Text with another Attributed Text in Swift. Please provide any sample code for appending operation of two attributed String in Swift.
using extension,
extension NSMutableAttributedString{
func getAttributedStringByAppending(attributedString:NSMutableAttributedString) -> NSMutableAttributedString{
let newAttributedString = NSMutableAttributedString()
newAttributedString.append(self)
newAttributedString.append(attributedString)
return newAttributedString
}
}
Usage: attributedString1, attributedString2 are two NSMutableAttributedString, then
let combinedAttributedString = attributedString1.getAttributedStringByAppending(attributedString: attributedString2)