<!--
{
  "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/EnvironmentValues/verticalSizeClass",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI17EnvironmentValuesV17verticalSizeClassAA013UserInterfacefG0OSgvp"
  },
  "title" : "verticalSizeClass"
}
-->

# verticalSizeClass

The vertical size class of this environment.

```
@backDeployed(before: macOS 14.0, tvOS 17.0, watchOS 10.0)
var verticalSizeClass: UserInterfaceSizeClass? { get set }
```

## Discussion

You receive a [`UserInterfaceSizeClass`](/documentation/SwiftUI/UserInterfaceSizeClass) value when you read this
environment value. The value tells you about the amount of vertical
space available to the view that reads it. You can read this
size class like any other of the [`EnvironmentValues`](/documentation/SwiftUI/EnvironmentValues), by creating a
property with the [`Environment`](/documentation/SwiftUI/Environment) property wrapper:

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

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

- The current device type.
- The orientation of the device.

You can adjust the appearance of custom views by reading this 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.

In watchOS, the vertical size class is always
[`UserInterfaceSizeClass.compact`](/documentation/SwiftUI/UserInterfaceSizeClass/compact). In macOS, and tvOS, it’s always
[`UserInterfaceSizeClass.regular`](/documentation/SwiftUI/UserInterfaceSizeClass/regular).

Writing to the vertical size class in the environment
before macOS 14.0, tvOS 17.0, and watchOS 10.0 is not supported.

---

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)