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

# NSDirectionalEdgeInsets

The inset distances for views, taking the user interface layout direction into account.

```
struct NSDirectionalEdgeInsets
```

## Topics

### Creating directional edge insets

[`init(top:leading:bottom:trailing:)`](/documentation/UIKit/NSDirectionalEdgeInsets/init(top:leading:bottom:trailing:)-6wnda)

Creates a directional edge insets structure that contains the specified values.

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

Creates a directional edge insets structure that contains default values.

[`init(_:)`](/documentation/UIKit/NSDirectionalEdgeInsets/init(_:))

Creates a directional edge insets structure from a SwiftUI edge insets structure.

### Creating directional edge insets

[`init(top:leading:bottom:trailing:)`](/documentation/UIKit/NSDirectionalEdgeInsets/init(top:leading:bottom:trailing:)-1th5h)

Creates a directional edge insets structure that contains the specified values.

### Getting the edge values

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

The bottom edge inset value.

[`leading`](/documentation/UIKit/NSDirectionalEdgeInsets/leading)

The leading edge inset value.

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

The top edge inset value.

[`trailing`](/documentation/UIKit/NSDirectionalEdgeInsets/trailing)

The trailing edge inset value.

### Converting to and from strings

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

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

### Converting to and from strings

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

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

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

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

### Getting the empty edge insets

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

A directional edge insets structure whose top, leading, bottom, and trailing fields all have a value of `0`.

### Comparing directional edge insets

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

Compares two directional edge insets to determine if they’re 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)