<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIEdgeInsets",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:@S@UIEdgeInsets"
  },
  "title" : "UIEdgeInsets"
}
-->

# UIEdgeInsets

The inset distances for views.

```
struct UIEdgeInsets
```

## Overview

Edge inset values are applied to a rectangle to shrink or expand the area represented by that rectangle. Typically, edge insets are used during view layout to modify the view’s frame. Positive values cause the frame to be inset (or shrunk) by the specified amount. Negative values cause the frame to be outset (or expanded) by the specified amount.

See also [`init(top:left:bottom:right:)`](/documentation/UIKit/UIEdgeInsets/init(top:left:bottom:right:)-1s1t9) and [`zero`](/documentation/UIKit/UIEdgeInsets/zero).

## Topics

### Creating edge insets

[`init(top:left:bottom:right:)`](/documentation/UIKit/UIEdgeInsets/init(top:left:bottom:right:)-6ff7)

Creates an edge insets structure with the specified edges.

[`init()`](/documentation/UIKit/UIEdgeInsets/init())

Initializes the edge insets structure to default values.

### Creating edge insets

[`init(top:left:bottom:right:)`](/documentation/UIKit/UIEdgeInsets/init(top:left:bottom:right:)-1s1t9)

Creates an edge insets structure with the specified edges.

### Getting the edge values

[`bottom`](/documentation/UIKit/UIEdgeInsets/bottom)

The bottom edge inset value.

[`left`](/documentation/UIKit/UIEdgeInsets/left)

The left edge inset value.

[`right`](/documentation/UIKit/UIEdgeInsets/right)

The right edge inset value.

[`top`](/documentation/UIKit/UIEdgeInsets/top)

The top edge inset value.

### Managing edge insets

  <doc://com.apple.documentation/documentation/CoreFoundation/CGRect/inset(by:)>

### Managing edge insets

[`UIEdgeInsetsInsetRect`](/documentation/UIKit/UIEdgeInsetsInsetRect)

Adjusts a rectangle by the given edge insets.

### Converting to and from strings

  <doc://com.apple.documentation/documentation/Foundation/NSCoder/string(for:)-26b4z>

  <doc://com.apple.documentation/documentation/Foundation/NSCoder/uiEdgeInsets(for:)>

### Converting to and from strings

[`NSStringFromUIEdgeInsets`](/documentation/UIKit/NSStringFromUIEdgeInsets)

Returns a string formatted to contain the data from an edge insets structure.

[`UIEdgeInsetsFromString`](/documentation/UIKit/UIEdgeInsetsFromString)

Returns a UIKit edge insets structure based on the data in the specified string.

### Getting the empty edge insets

[`zero`](/documentation/UIKit/UIEdgeInsets/zero)

An edge insets struct whose top, left, bottom, and right fields are all set to `0`.

### Comparing edge insets

[`UIEdgeInsetsEqualToEdgeInsets(_:_:)`](/documentation/UIKit/UIEdgeInsetsEqualToEdgeInsets(_:_:))

Returns a Boolean value indicating whether the two edge insets are the same.

[`UIEdgeInsetsEqualToEdgeInsets`](/documentation/UIKit/UIEdgeInsetsEqualToEdgeInsets)

Returns a Boolean value indicating whether the two edge insets are the same.



---

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)