'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?



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Claudio