NSAttributedString has a size()
method which the new AttributedString lacks. How do you get the size of the new AttributedString?
Asked
Active
Viewed 248 times
1

Melodius
- 2,505
- 3
- 22
- 37
-
2Well it depends, what *exactly* do you mean by size? – Alexander May 06 '22 at 19:40
-
I have the same doubt as @Alexander , by 'size' do you mean the font size or the character count of your string? – Savvy May 07 '22 at 00:24
-
From the documentation of NSAttributedString.size(): `Returns the size necessary to draw the string.` – Melodius May 07 '22 at 06:44
1 Answers
2
You could convert your AttributedString to an NSAttributedString and then call the size
method, although this seems more like a workaround.
let myNSAttributedString = NSAttributedString(myAttributedString)
myNSAttributedString.size()

Claudio
- 5,078
- 1
- 22
- 33