<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/allowsTightening(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE16allowsTighteningyQrSbF"
  },
  "title" : "allowsTightening(_:)"
}
-->

# allowsTightening(_:)

Sets whether text in this view can compress the space between characters
when necessary to fit text in a line.

```
nonisolated func allowsTightening(_ flag: Bool) -> some View
```

## Parameters

`flag`

A Boolean value that indicates whether the space
between characters compresses when necessary.

## Return Value

A view that can compress the space between characters when
necessary to fit text in a line.

## Discussion

Use `allowsTightening(_:)` to enable the compression of inter-character
spacing of text in a view to try to fit the text in the view’s bounds.

In the example below, two identically configured text views show the
effects of `allowsTightening(_:)` on the compression of the spacing
between characters:

```
VStack {
    Text("This is a wide text element")
        .font(.body)
        .frame(width: 200, height: 50, alignment: .leading)
        .lineLimit(1)
        .allowsTightening(true)

    Text("This is a wide text element")
        .font(.body)
        .frame(width: 200, height: 50, alignment: .leading)
        .lineLimit(1)
        .allowsTightening(false)
}
```

![A screenshot showing the effect of enabling text tightening in a](images/com.apple.SwiftUI/SwiftUI-view-allowsTightening@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)