Instance Method


Returns the size required to draw the string.


iOS, Mac Catalyst, tvOS, watchOS
func size() -> CGSize
func size() -> NSSize

Return Value

The minimum size required to draw the entire contents of the string.


You can use this method prior to drawing to compute how much space is required to draw the string.

This method may return fractional sizes. When setting the size of your view, use the ceil function to round fractional values up to the nearest whole number.

See Also

Getting Metrics for the String

func containsAttachments(in: NSRange) -> Bool

Returns a Boolean value that indicates if the attributed string contains a property configured in the specified range.