<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/UserInterfaceSizeClass",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI22UserInterfaceSizeClassO"
  },
  "title" : "UserInterfaceSizeClass"
}
-->

# UserInterfaceSizeClass

A set of values that indicate the visual size available to the view.

```
enum UserInterfaceSizeClass
```

## Overview

You receive a size class value when you read either the
[`horizontalSizeClass`](/documentation/SwiftUI/EnvironmentValues/horizontalSizeClass) or
[`verticalSizeClass`](/documentation/SwiftUI/EnvironmentValues/verticalSizeClass) environment value. The value tells
you about the amount of space available to your views in a given
direction. You can read the size class like any other of the
[`EnvironmentValues`](/documentation/SwiftUI/EnvironmentValues), by creating a property with the [`Environment`](/documentation/SwiftUI/Environment)
property wrapper:

```
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@Environment(\.verticalSizeClass) private var verticalSizeClass
```

SwiftUI sets the size class based on several factors, including:

- The current device type.
- The orientation of the device.
- The appearance of Slide Over and Split View on iPad.

Several built-in views change their behavior based on the size class.
For example, a [`NavigationView`](/documentation/SwiftUI/NavigationView) presents a multicolumn view when
the horizontal size class is [`UserInterfaceSizeClass.regular`](/documentation/SwiftUI/UserInterfaceSizeClass/regular),
but a single column otherwise. You can also adjust the appearance of
custom views by reading the size class and conditioning your views.
If you do, be prepared to handle size class changes while
your app runs, because factors like device orientation can change at
runtime.

## Topics

### Getting size classes

[`UserInterfaceSizeClass.compact`](/documentation/SwiftUI/UserInterfaceSizeClass/compact)

The compact size class.

[`UserInterfaceSizeClass.regular`](/documentation/SwiftUI/UserInterfaceSizeClass/regular)

The regular size class.

### Creating a size class

[`init(_:)`](/documentation/SwiftUI/UserInterfaceSizeClass/init(_:))

Creates a SwiftUI size class from the specified UIKit size class.



---

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)