I have used this line of code before release of iOS 10.3 ,and worked fine.
NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] in
***You can pass it to function & Enjoy !!!
func customString(currentprice:String,oldPrice:String) -> NSMutableAttributedString{
// 1
let NewString = currentprice + " " + oldPrice
let string = NewString as NSString
let attributedString = NSMutableAttributedString(string: string as String)
// 2
let firstAttributes = [NSForegroundColorAttributeName: UIColor(red: 238/255, green: 140/255, blue: 84/255, alpha: 1),NSBaselineOffsetAttributeName:1]
let secondAttributes = [NSForegroundColorAttributeName: UIColor.lightGrayColor(), NSStrikethroughStyleAttributeName: 1]
// 3
attributedString.addAttributes(firstAttributes, range: string.rangeOfString(currentprice))
attributedString.addAttributes(secondAttributes, range: string.rangeOfString(oldPrice))
return attributedString
}
and use like:
YourUILabel.attributedText = customString("300", oldPrice: "400")