So I have a formatted String
that looks like this:
let myString = String(format: "%@ %@ \n\n", "App Version:".makeBold(), AppSettings.appVersion)
//Extension looks like this
extension String {
func makeBold() -> NSAttributedString {
let attribute: [NSAttributedString.Key: Any] = [
.font: UIFont.OpenSansStyle.bold
]
return NSAttributedString(string: self, attributes: attribute)
}
}
Now, this obviously dosn't work since it returns an NSAttributed String
in the middle of a regular String
. But how do I make this happen? I need to have the String(format:)
to arrange the values in the correct way. But at the same time I need part of the text to be bold.