---
title: "nsDirectionalEdgeInsets(for:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/nscoder/nsdirectionaledgeinsets(for:)"
---

# nsDirectionalEdgeInsets(for:)

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

## Declaration

```swift
class func nsDirectionalEdgeInsets(for string: String) -> NSDirectionalEdgeInsets
```

## Parameters

- `string`: A string whose contents are of the form “{top, leading, bottom, trailing}”, where top, leading, bottom, trailing are the floating-point component values of the doc://com.apple.documentation/documentation/AppKit/NSDirectionalEdgeInsets structure. An example of a valid string is “{3.0,8.0,3.0,5.0}”. The string is not localized, so items are always separated with a comma.

## Return Value

Return Value A directional edge insets data structure. If the string is not well-formed, the function returns NSDirectionalEdgeInsetsZero.

## See Also

### Representing Geometric Types as Strings

- [cgAffineTransform(for:)](foundation/nscoder/cgaffinetransform(for:).md)
- [cgPoint(for:)](foundation/nscoder/cgpoint(for:).md)
- [cgRect(for:)](foundation/nscoder/cgrect(for:).md)
- [cgSize(for:)](foundation/nscoder/cgsize(for:).md)
- [cgVector(for:)](foundation/nscoder/cgvector(for:).md)
- [uiEdgeInsets(for:)](foundation/nscoder/uiedgeinsets(for:).md)
- [uiOffset(for:)](foundation/nscoder/uioffset(for:).md)
- [string(for:)](foundation/nscoder/string(for:)-4qz0a.md)
- [string(for:)](foundation/nscoder/string(for:)-4omzv.md)
- [string(for:)](foundation/nscoder/string(for:)-6yx6n.md)
- [string(for:)](foundation/nscoder/string(for:)-6ix86.md)
- [string(for:)](foundation/nscoder/string(for:)-2f1xb.md)
- [string(for:)](foundation/nscoder/string(for:)-hp8b.md)
- [string(for:)](foundation/nscoder/string(for:)-26b4z.md)
- [string(for:)](foundation/nscoder/string(for:)-454dj.md)
