Instance Method

size()

Returns the size required to draw the string.

Declaration

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

Return Value

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

Discussion

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.