Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the size of the new swift AttributedString?

NSAttributedString has a size() method which the new AttributedString lacks. How do you get the size of the new AttributedString?

like image 321
Melodius Avatar asked Nov 14 '25 17:11

Melodius


1 Answers

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()
like image 84
Claudio Avatar answered Nov 17 '25 10:11

Claudio