<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIView/userInterfaceLayoutDirection(for:relativeTo:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIView(cm)userInterfaceLayoutDirectionForSemanticContentAttribute:relativeToLayoutDirection:"
  },
  "title" : "userInterfaceLayoutDirection(for:relativeTo:)"
}
-->

# userInterfaceLayoutDirection(for:relativeTo:)

Returns the layout direction implied by the specified semantic content attribute, relative to the specified layout direction.

```
class func userInterfaceLayoutDirection(for semanticContentAttribute: UISemanticContentAttribute, relativeTo layoutDirection: UIUserInterfaceLayoutDirection) -> UIUserInterfaceLayoutDirection
```

## Parameters

`semanticContentAttribute`

The semantic content attribute for a view.

`layoutDirection`

The user interface layout direction ([`UIUserInterfaceLayoutDirection.leftToRight`](/documentation/UIKit/UIUserInterfaceLayoutDirection/leftToRight) or [`UIUserInterfaceLayoutDirection.rightToLeft`](/documentation/UIKit/UIUserInterfaceLayoutDirection/rightToLeft)).

## Return Value

The layout direction implied by the semantic content attribute and relative to the layout direction.

## Discussion

For example, when this method is passed a layout direction of [`UIUserInterfaceLayoutDirection.rightToLeft`](/documentation/UIKit/UIUserInterfaceLayoutDirection/rightToLeft) and a semantic content attribute of [`UISemanticContentAttribute.playback`](/documentation/UIKit/UISemanticContentAttribute/playback), it returns [`UIUserInterfaceLayoutDirection.leftToRight`](/documentation/UIKit/UIUserInterfaceLayoutDirection/leftToRight). Although layout and drawing code can use this method to determine how to arrange elements, it might be easier to query the container view’s [`effectiveUserInterfaceLayoutDirection`](/documentation/UIKit/UIView/effectiveUserInterfaceLayoutDirection) property instead.

---

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)