case compact
case regular
Availability 有効性
Technology
enum UserInterfaceSizeClass
You receive a size class value when you read either the horizontal
or vertical
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 Environment
, by creating a property with the Environment
property wrapper:
private var horizontalSizeClass (\.horizontalSizeClass)
private var verticalSizeClass (\.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 Navigation
presents a multicolumn view when the horizontal size class is User
, 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.
case compact
case regular
init?(UIUserInterfaceSizeClass )
static func == (UserInterfaceSizeClass , UserInterfaceSizeClass ) -> Bool
static func != (Self, Self) -> Bool
func hash(into: inout Hasher)
var hashValue : Int
enum ColorScheme
enum ColorSchemeContrast
enum EditMode