How to get the size of the new swift AttributedString?

517 Views Asked by At

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

1

There are 1 best solutions below

1
Claudio On

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()