<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCoder/uiOffset(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@F@UIOffsetFromString"
  },
  "title" : "uiOffset(for:)"
}
-->

# uiOffset(for:)

Returns a UIKit offset structure corresponding to the data in a given string.

```
class func uiOffset(for string: String) -> UIOffset
```

## Parameters

`string`

A string containing a representation of an offset.

## Return Value

An edge insets data structure. If the string is not well-formed, the function returns <doc://com.apple.documentation/documentation/UIKit/UIOffset/zero>.

## Discussion

In general, you should use this function only to convert strings that were previously created using the [`string(for:)`](/documentation/Foundation/NSCoder/string(for:)-454dj) function.

---

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)