1. NSAttributedString
Until Swift 3 we were able to create NSAttributedString as follows:
let myMutableString = NSAttributedString(string: "My String", attributes: [NSForegroundColorAttributeName: UIColor.white])
which follows the below syntax as reference
let = NSAttributedString(string: "String Name", attributes: [< NSAttributeName>: ])
But it has been changed as follows:
let = NSAttributedString(string: "String Name", attributes: [< NSAttributedStringKey>: ])
So lets see what is NSAttributedStringKey
NSAtrributedStringKey
1. Initialise:
let attributedStringKey = NSAtrributedStringKey.init("")
or we can use the raw values
let attributedStringKey = NSAtrributedStringKey.init(rawValue: "")
for reference you can go through this link.
Until Swift 3 we were able to create NSAttributedString as follows:
let myMutableString = NSAttributedString(string: "My String", attributes: [NSForegroundColorAttributeName: UIColor.white])
which follows the below syntax as reference
let
But it has been changed as follows:
let
So lets see what is NSAttributedStringKey
NSAtrributedStringKey
1. Initialise:
let attributedStringKey = NSAtrributedStringKey.init("
or we can use the raw values
let attributedStringKey = NSAtrributedStringKey.init(rawValue: "
for reference you can go through this link.