I am trying to add 2 white space at the last position of a string but when I set this in a label I found no space. But if I added 2 white space with another character, it works ok. Then I tried to add 2 white space with some extra character and then trim these extra characters. But for all these case I observed no space when I placed this in a text label. I am trying this for the right alignment.
let name: String = self.cityModelArr[indexPos].countryShortName+" 12"
let endIndex = name.index(name.endIndex, offsetBy: -2)
let truncated = String(name[..<endIndex])
self.testLabel.text = truncated
I have tried some more solutions from the internet but failed to achieve my goal.