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

# UIOffset

A structure that specifies an amount to offset a position.

```
struct UIOffset
```

## Overview

The components are positive for right or down, negative for left or up.

See also [`Initializing offsets`](/documentation/UIKit/UIOffset#Initializing-offsets) and [`zero`](/documentation/UIKit/UIOffset/zero).

## Topics

### Initializing offsets

[`init(horizontal:vertical:)`](/documentation/UIKit/UIOffset/init(horizontal:vertical:)-9wl8x)

Creates an offset structure from the given components.

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

Creates an offset structure.

### Initializing offsets

[`init(horizontal:vertical:)`](/documentation/UIKit/UIOffset/init(horizontal:vertical:)-2bvnj)

Returns an offset structure from the given components.

### Getting the offset values

[`horizontal`](/documentation/UIKit/UIOffset/horizontal)

The amount of horizontal offset from a position.

[`vertical`](/documentation/UIKit/UIOffset/vertical)

The amount of vertical offset from a position.

### Comparing offsets

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

Returns a Boolean value that indicates whether two offsets are equal.

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

Returns a Boolean value that indicates whether two offsets are equal.

### Converting to and from strings

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

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

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

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

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

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

### Getting the empty offset value

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

An offset structure with no offset in the horizontal and vertical directions.



---

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)