---
title: "CTLineGetTrailingWhitespaceWidth(_:)"
framework: coretext
role: symbol
role_heading: Function
path: "coretext/ctlinegettrailingwhitespacewidth(_:)"
---

# CTLineGetTrailingWhitespaceWidth(_:)

Returns the trailing whitespace width for a line.

## Declaration

```swift
func CTLineGetTrailingWhitespaceWidth(_ line: CTLine) -> Double
```

## Parameters

- `line`: The line whose trailing whitespace width is calculated.

## Return Value

Return Value The width of the line’s trailing whitespace. If the line is invalid, this function will always return zero.

## Discussion

Discussion Creating a line for a width can result in a line that is actually longer than the desired width due to trailing whitespace. Although this is typically not an issue due to whitespace being invisible, this function can be used to determine what amount of a line’s width is due to trailing whitespace.

## See Also

### Measuring Lines

- [CTLineGetImageBounds(_:_:)](coretext/ctlinegetimagebounds(_:_:).md)
- [CTLineGetTypographicBounds(_:_:_:_:)](coretext/ctlinegettypographicbounds(_:_:_:_:).md)
