imageScale
TypeScriptget imageScale(): Image_ScaleSwift declarationvar imageScale: Image.Scale { get set }The image scale for this environment.
struct · iOS 13.0+ · SDK 27.1
struct EnvironmentValuesA collection of environment values propagated through a view hierarchy. SwiftUI exposes a collection of values to your app's views in an `EnvironmentValues` structure. To read a value from the structure, declare a property using the ``Environment`` property wrapper and specify the value's key path. For example, you can read the current locale: @Environment(\.locale) var locale: Locale Use the property you declare to dynamically control a view's layout. SwiftUI automatically sets or updates many environment values, like ``EnvironmentValues/pixelLength``, ``EnvironmentValues/scenePhase``, or ``EnvironmentValues/locale``, based on device characteristics, system state, or user settings. For others, like ``EnvironmentValues/lineLimit``, SwiftUI provides a reasonable default value. You can set or override some values using the ``View/environment(_:_:)`` view modifier: MyView() .environment(\.lineLimit, 2) The value that you set affects the environment for the view that you modify --- including its descendants in the view hierarchy --- but only up to the point where you apply a different environment modifier. SwiftUI provides dedicated view modifiers for setting some values, which typically makes your code easier to read. For example, rather than setting the ``EnvironmentValues/lineLimit`` value directly, as in the previous example, you should instead use the ``View/lineLimit(_:)`` modifier: MyView() .lineLimit(2) In some cases, using a dedicated view modifier provides additional functionality. For example, you must use the ``View/preferredColorScheme(_:)`` modifier rather than setting ``EnvironmentValues/colorScheme`` directly to ensure that the new value propagates up to the presenting container when presenting a view like a popover: MyView() .popover(isPresented: $isPopped) { PopoverContent() .preferredColorScheme(.dark) } Create a custom environment value by declaring a new property in an extension to the environment values structure and applying the ``Entry()`` macro to the variable declaration: extension EnvironmentValues { @Entry var myCustomValue: String = "Default value" } extension View { func myCustomValue(_ myCustomValue: String) -> some View { environment(\.myCustomValue, myCustomValue) } } Clients of your value then access the value in the usual way, reading it with the ``Environment`` property wrapper, and setting it with the `myCustomValue` view modifier.
get imageScale(): Image_ScaleSwift declarationvar imageScale: Image.Scale { get set }The image scale for this environment.
set imageScale(value: Image_Scale)Swift declarationvar imageScale: Image.Scale { get set }The image scale for this environment.
get lineHeight(): (_CoreText_AttributedString_LineHeight) | nullSwift declarationvar lineHeight: AttributedString.LineHeight? { get set }The default line height for text influenced by this environment. The default value is `nil`. In that case, SwiftUI automatically chooses an appropriate line height setting for each context.
set lineHeight(value: (_CoreText_AttributedString_LineHeight) | null)Swift declarationvar lineHeight: AttributedString.LineHeight? { get set }The default line height for text influenced by this environment. The default value is `nil`. In that case, SwiftUI automatically chooses an appropriate line height setting for each context.
get colorScheme(): ColorSchemeSwift declarationvar colorScheme: ColorScheme { get set }The color scheme of this environment. Read this environment value from within a view to find out if SwiftUI is currently displaying the view using the ``ColorScheme/light`` or ``ColorScheme/dark`` appearance. The value that you receive depends on whether the user has enabled Dark Mode, possibly superseded by the configuration of the current presentation's view hierarchy. @Environment(\.colorScheme) private var colorScheme var body: some View { Text(colorScheme == .dark ? "Dark" : "Light") } You can set the `colorScheme` environment value directly, but that usually isn't what you want. Doing so changes the color scheme of the given view and its child views but *not* the views above it in the view hierarchy. Instead, set a color scheme using the ``View/preferredColorScheme(_:)`` modifier, which also propagates the value up through the view hierarchy to the enclosing presentation, like a sheet or a window. When adjusting your app's user interface to match the color scheme, consider also checking the ``EnvironmentValues/colorSchemeContrast`` property, which reflects a system-wide contrast setting that the user controls. For information, see <doc://com.apple.documentation/design/human-interface-guidelines/accessibility#Color-and-effects> in the Human Interface Guidelines. > Note: If you only need to provide different colors or images for different color scheme and contrast settings, do that in your app's Asset Catalog. See <doc://com.apple.documentation/documentation/Xcode/Asset-Management>.
set colorScheme(value: ColorScheme)Swift declarationvar colorScheme: ColorScheme { get set }The color scheme of this environment. Read this environment value from within a view to find out if SwiftUI is currently displaying the view using the ``ColorScheme/light`` or ``ColorScheme/dark`` appearance. The value that you receive depends on whether the user has enabled Dark Mode, possibly superseded by the configuration of the current presentation's view hierarchy. @Environment(\.colorScheme) private var colorScheme var body: some View { Text(colorScheme == .dark ? "Dark" : "Light") } You can set the `colorScheme` environment value directly, but that usually isn't what you want. Doing so changes the color scheme of the given view and its child views but *not* the views above it in the view hierarchy. Instead, set a color scheme using the ``View/preferredColorScheme(_:)`` modifier, which also propagates the value up through the view hierarchy to the enclosing presentation, like a sheet or a window. When adjusting your app's user interface to match the color scheme, consider also checking the ``EnvironmentValues/colorSchemeContrast`` property, which reflects a system-wide contrast setting that the user controls. For information, see <doc://com.apple.documentation/design/human-interface-guidelines/accessibility#Color-and-effects> in the Human Interface Guidelines. > Note: If you only need to provide different colors or images for different color scheme and contrast settings, do that in your app's Asset Catalog. See <doc://com.apple.documentation/documentation/Xcode/Asset-Management>.
get controlSize(): ControlSizeSwift declarationvar controlSize: ControlSize { get set }The size to apply to controls within a view. The default is ``ControlSize/regular``.
set controlSize(value: ControlSize)Swift declarationvar controlSize: ControlSize { get set }The size to apply to controls within a view. The default is ``ControlSize/regular``.
get description(): stringSwift declarationvar description: String { get }A string that represents the contents of the environment values instance.
get lineSpacing(): numberSwift declarationvar lineSpacing: CGFloat { get set }The distance in points between the bottom of one line fragment and the top of the next. This value is always nonnegative.
set lineSpacing(value: number)Swift declarationvar lineSpacing: CGFloat { get set }The distance in points between the bottom of one line fragment and the top of the next. This value is always nonnegative.
get pixelLength(): numberSwift declarationvar pixelLength: CGFloat { get }The size of a pixel on the screen. This value is usually equal to `1` divided by ``EnvironmentValues/displayScale``.
get buttonSizing(): ButtonSizingSwift declarationvar buttonSizing: ButtonSizing { get }The preferred sizing behavior of buttons in the view hierarchy. Views may use the specified button sizing when determining the size they choose to be in their primary axis within their parent view's proposed size. Use ``View/buttonSizing(_:)`` to set the preferred sizing behavior in the environment. Many built-in controls that display as a button adapt to this environment value. You can read the environment value in your own views and styles as well to adapt to the preferred sizing. struct CustomButtonStyle: ButtonStyle { @Environment(\.buttonSizing) private var buttonSizing private var maxWidth: CGFloat { switch buttonSizing { case .flexible: .infinity case .fitted, _: nil } } func makeBody(configuration: Configuration) -> some View { configuration.content .frame(maxWidth: maxWidth) .background(.tint, in: Capsule()) } }
get displayScale(): numberSwift declarationvar displayScale: CGFloat { get set }The display scale of this environment.
set displayScale(value: number)Swift declarationvar displayScale: CGFloat { get set }The display scale of this environment.
get sizeCategory(): ContentSizeCategorySwift declarationvar sizeCategory: ContentSizeCategory { get set }The preferred size of the content. The default value is ``ContentSizeCategory/large``.
set sizeCategory(value: ContentSizeCategory)Swift declarationvar sizeCategory: ContentSizeCategory { get set }The preferred size of the content. The default value is ``ContentSizeCategory/large``.
get appearsActive(): booleanSwift declaration@backDeployed(before: macOS 15.0)
var appearsActive: Bool { get set }Whether views and styles in this environment should prefer an active appearance over an inactive appearance. On macOS, views in the focused window (also referred to as the "key" window) should appear active. Some contexts also appear active in other circumstances, such as the contents of a window toolbar appearing active when the window is not focused but is the main window. Typical adjustments made when a view does not appear active include: - Uses of `Color.accentColor` should generally be removed or replaced with a desaturated style. - Text and image content in sidebars should appear dimmer. - Buttons with destructive actions should appear disabled. - `ShapeStyle.selection` and selection in list and tables will automatically become a grey color Custom views, styles, and shape styles can use this to adjust their own appearance: struct ProminentPillButtonStyle: ButtonStyle { @Environment(\.appearsActive) private var appearsActive func makeBody(configuration: Configuration) -> some View { configuration.label .lineLimit(1) .padding(.horizontal, 8) .padding(.vertical, 2) .frame(minHeight: 20) .overlay(Capsule().strokeBorder(.tertiary)) .background(appearsActive ? Color.accentColor : .clear, in: .capsule) .contentShape(.capsule) } } On all other platforms, this value is always `true`. This is bridged with `UITraitCollection.activeAppearance` for UIKit hosted content.
set appearsActive(value: boolean)Swift declaration@backDeployed(before: macOS 15.0)
var appearsActive: Bool { get set }Whether views and styles in this environment should prefer an active appearance over an inactive appearance. On macOS, views in the focused window (also referred to as the "key" window) should appear active. Some contexts also appear active in other circumstances, such as the contents of a window toolbar appearing active when the window is not focused but is the main window. Typical adjustments made when a view does not appear active include: - Uses of `Color.accentColor` should generally be removed or replaced with a desaturated style. - Text and image content in sidebars should appear dimmer. - Buttons with destructive actions should appear disabled. - `ShapeStyle.selection` and selection in list and tables will automatically become a grey color Custom views, styles, and shape styles can use this to adjust their own appearance: struct ProminentPillButtonStyle: ButtonStyle { @Environment(\.appearsActive) private var appearsActive func makeBody(configuration: Configuration) -> some View { configuration.label .lineLimit(1) .padding(.horizontal, 8) .padding(.vertical, 2) .frame(minHeight: 20) .overlay(Capsule().strokeBorder(.tertiary)) .background(appearsActive ? Color.accentColor : .clear, in: .capsule) .contentShape(.capsule) } } On all other platforms, this value is always `true`. This is bridged with `UITraitCollection.activeAppearance` for UIKit hosted content.
get symbolVariants(): SymbolVariantsSwift declarationvar symbolVariants: SymbolVariants { get set }The symbol variant to use in this environment. You set this environment value indirectly by using the ``View/symbolVariant(_:)`` view modifier. However, you access the environment variable directly using the ``View/environment(_:_:)`` modifier. Do this when you want to use the ``SymbolVariants/none`` variant to ignore the value that's already in the environment: HStack { Image(systemName: "heart") Image(systemName: "heart") .environment(\.symbolVariants, .none) } .symbolVariant(.fill) 
set symbolVariants(value: SymbolVariants)Swift declarationvar symbolVariants: SymbolVariants { get set }The symbol variant to use in this environment. You set this environment value indirectly by using the ``View/symbolVariant(_:)`` view modifier. However, you access the environment variable directly using the ``View/environment(_:_:)`` modifier. Do this when you want to use the ``SymbolVariants/none`` variant to ignore the value that's already in the environment: HStack { Image(systemName: "heart") Image(systemName: "heart") .environment(\.symbolVariants, .none) } .symbolVariant(.fill) 
get truncationMode(): Text_TruncationModeSwift declarationvar truncationMode: Text.TruncationMode { get set }A value that indicates how the layout truncates the last line of text to fit into the available space. The default value is ``Text/TruncationMode/tail``. Some controls, however, might have a different default if appropriate.
set truncationMode(value: Text_TruncationMode)Swift declarationvar truncationMode: Text.TruncationMode { get set }A value that indicates how the layout truncates the last line of text to fit into the available space. The default value is ``Text/TruncationMode/tail``. Some controls, however, might have a different default if appropriate.
get backgroundStyle(): (AnyShapeStyle) | nullSwift declarationvar backgroundStyle: AnyShapeStyle? { get set }An optional style that overrides the default system background style when set.
set backgroundStyle(value: (AnyShapeStyle) | null)Swift declarationvar backgroundStyle: AnyShapeStyle? { get set }An optional style that overrides the default system background style when set.
get dynamicTypeSize(): DynamicTypeSizeSwift declarationvar dynamicTypeSize: DynamicTypeSize { get set }The current Dynamic Type size. This value changes as the user's chosen Dynamic Type size changes. The default value is device-dependent. When limiting the Dynamic Type size, consider if adding a large content view with ``View/accessibilityShowsLargeContentViewer()`` would be appropriate. On macOS, this value cannot be changed by users and does not affect the text size.
set dynamicTypeSize(value: DynamicTypeSize)Swift declarationvar dynamicTypeSize: DynamicTypeSize { get set }The current Dynamic Type size. This value changes as the user's chosen Dynamic Type size changes. The default value is device-dependent. When limiting the Dynamic Type size, consider if adding a large content view with ``View/accessibilityShowsLargeContentViewer()`` would be appropriate. On macOS, this value cannot be changed by users and does not affect the text size.
get layoutDirection(): LayoutDirectionSwift declarationvar layoutDirection: LayoutDirection { get set }The layout direction associated with the current environment. Use this value to determine or set whether the environment uses a left-to-right or right-to-left direction.
set layoutDirection(value: LayoutDirection)Swift declarationvar layoutDirection: LayoutDirection { get set }The layout direction associated with the current environment. Use this value to determine or set whether the environment uses a left-to-right or right-to-left direction.
get allowsTightening(): booleanSwift declarationvar allowsTightening: Bool { get set }A Boolean value that indicates whether inter-character spacing should tighten to fit the text into the available space. The default value is `false`.
set allowsTightening(value: boolean)Swift declarationvar allowsTightening: Bool { get set }A Boolean value that indicates whether inter-character spacing should tighten to fit the text into the available space. The default value is `false`.
get headerProminence(): ProminenceSwift declarationvar headerProminence: Prominence { get set }The prominence to apply to section headers within a view. The default is ``Prominence/standard``.
set headerProminence(value: Prominence)Swift declarationvar headerProminence: Prominence { get set }The prominence to apply to section headers within a view. The default is ``Prominence/standard``.
get legibilityWeight(): (LegibilityWeight) | nullSwift declarationvar legibilityWeight: LegibilityWeight? { get set }The font weight to apply to text. This value reflects the value of the Bold Text display setting found in the Accessibility settings.
set legibilityWeight(value: (LegibilityWeight) | null)Swift declarationvar legibilityWeight: LegibilityWeight? { get set }The font weight to apply to text. This value reflects the value of the Bold Text display setting found in the Accessibility settings.
get redactionReasons(): RedactionReasonsSwift declarationvar redactionReasons: RedactionReasons { get set }The current redaction reasons applied to the view hierarchy.
set redactionReasons(value: RedactionReasons)Swift declarationvar redactionReasons: RedactionReasons { get set }The current redaction reasons applied to the view hierarchy.
get contentTransition(): ContentTransitionSwift declarationvar contentTransition: ContentTransition { get set }The current method of animating the contents of views.
set contentTransition(value: ContentTransition)Swift declarationvar contentTransition: ContentTransition { get set }The current method of animating the contents of views.
get verticalSizeClass(): (UserInterfaceSizeClass) | nullSwift declaration@backDeployed(before: macOS 14.0, tvOS 17.0, watchOS 10.0)
var verticalSizeClass: UserInterfaceSizeClass? { get set }The vertical size class of this environment. You receive a ``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``, by creating a property with the ``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``. In macOS, and tvOS, it's always ``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.
set verticalSizeClass(value: (UserInterfaceSizeClass) | null)Swift declaration@backDeployed(before: macOS 14.0, tvOS 17.0, watchOS 10.0)
var verticalSizeClass: UserInterfaceSizeClass? { get set }The vertical size class of this environment. You receive a ``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``, by creating a property with the ``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``. In macOS, and tvOS, it's always ``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.
get backgroundMaterial(): (Material) | nullSwift declarationvar backgroundMaterial: Material? { get set }The material underneath the current view. This value is `nil` if the current background isn't one of the standard materials. If you set a material, the standard content styles enable their vibrant rendering modes. You set this value by calling one of the background modifiers that takes a ``ShapeStyle``, like ``View/background(_:ignoresSafeAreaEdges:)`` or ``View/background(_:in:fillStyle:)``, and passing in a ``Material``. You can also set the value manually, using `nil` to disable vibrant rendering, or a ``Material`` instance to enable the vibrancy style associated with the specified material.
set backgroundMaterial(value: (Material) | null)Swift declarationvar backgroundMaterial: Material? { get set }The material underneath the current view. This value is `nil` if the current background isn't one of the standard materials. If you set a material, the standard content styles enable their vibrant rendering modes. You set this value by calling one of the background modifiers that takes a ``ShapeStyle``, like ``View/background(_:ignoresSafeAreaEdges:)`` or ``View/background(_:in:fillStyle:)``, and passing in a ``Material``. You can also set the value manually, using `nil` to disable vibrant rendering, or a ``Material`` instance to enable the vibrancy style associated with the specified material.
get isLuminanceReduced(): booleanSwift declarationvar isLuminanceReduced: Bool { get set }A Boolean value that indicates whether the display or environment currently requires reduced luminance. When you detect this condition, lower the overall brightness of your view. For example, you can change large, filled shapes to be stroked, and choose less bright colors: @Environment(\.isLuminanceReduced) var isLuminanceReduced var body: some View { if isLuminanceReduced { Circle() .stroke(Color.gray, lineWidth: 10) } else { Circle() .fill(Color.white) } } In addition to the changes that you make, the system could also dim the display to achieve a suitable brightness. By reacting to `isLuminanceReduced`, you can preserve contrast and readability while helping to satisfy the reduced brightness requirement. > Note: On watchOS, the system typically sets this value to `true` when the user lowers their wrist, but the display remains on. Starting in watchOS 8, the system keeps your view visible on wrist down by default. If you want the system to blur the screen instead, as it did in earlier versions of watchOS, set the value for the <doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/WKSupportsAlwaysOnDisplay> key in your app's <doc://com.apple.documentation/documentation/BundleResources/Information-Property-List> file to `false`.
set isLuminanceReduced(value: boolean)Swift declarationvar isLuminanceReduced: Bool { get set }A Boolean value that indicates whether the display or environment currently requires reduced luminance. When you detect this condition, lower the overall brightness of your view. For example, you can change large, filled shapes to be stroked, and choose less bright colors: @Environment(\.isLuminanceReduced) var isLuminanceReduced var body: some View { if isLuminanceReduced { Circle() .stroke(Color.gray, lineWidth: 10) } else { Circle() .fill(Color.white) } } In addition to the changes that you make, the system could also dim the display to achieve a suitable brightness. By reacting to `isLuminanceReduced`, you can preserve contrast and readability while helping to satisfy the reduced brightness requirement. > Note: On watchOS, the system typically sets this value to `true` when the user lowers their wrist, but the display remains on. Starting in watchOS 8, the system keeps your view visible on wrist down by default. If you want the system to blur the screen instead, as it did in earlier versions of watchOS, set the value for the <doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/WKSupportsAlwaysOnDisplay> key in your app's <doc://com.apple.documentation/documentation/BundleResources/Information-Property-List> file to `false`.
get minimumScaleFactor(): numberSwift declarationvar minimumScaleFactor: CGFloat { get set }The minimum permissible proportion to shrink the font size to fit the text into the available space. In the example below, a label with a `minimumScaleFactor` of `0.5` draws its text in a font size as small as half of the actual font if needed to fit into the space next to the text input field: HStack { Text("This is a very long label:") .lineLimit(1) .minimumScaleFactor(0.5) TextField("My Long Text Field", text: $myTextField) .frame(width: 250, height: 50, alignment: .center) }  You can set the minimum scale factor to any value greater than `0` and less than or equal to `1`. The default value is `1`. SwiftUI uses this value to shrink text that doesn't fit in a view when it's okay to shrink the text. For example, a label with a `minimumScaleFactor` of `0.5` draws its text in a font size as small as half the actual font if needed.
set minimumScaleFactor(value: number)Swift declarationvar minimumScaleFactor: CGFloat { get set }The minimum permissible proportion to shrink the font size to fit the text into the available space. In the example below, a label with a `minimumScaleFactor` of `0.5` draws its text in a font size as small as half of the actual font if needed to fit into the space next to the text input field: HStack { Text("This is a very long label:") .lineLimit(1) .minimumScaleFactor(0.5) TextField("My Long Text Field", text: $myTextField) .frame(width: 250, height: 50, alignment: .center) }  You can set the minimum scale factor to any value greater than `0` and less than or equal to `1`. The default value is `1`. SwiftUI uses this value to shrink text that doesn't fit in a view when it's okay to shrink the text. For example, a label with a `minimumScaleFactor` of `0.5` draws its text in a font size as small as half the actual font if needed.
get allowedDynamicRange(): (Image_DynamicRange) | nullSwift declarationvar allowedDynamicRange: Image.DynamicRange? { get set }The allowed dynamic range for the view, or nil.
set allowedDynamicRange(value: (Image_DynamicRange) | null)Swift declarationvar allowedDynamicRange: Image.DynamicRange? { get set }The allowed dynamic range for the view, or nil.
get colorSchemeContrast(): ColorSchemeContrastSwift declarationvar colorSchemeContrast: ColorSchemeContrast { get }The contrast associated with the color scheme of this environment. Read this environment value from within a view to find out if SwiftUI is currently displaying the view using ``ColorSchemeContrast/standard`` or ``ColorSchemeContrast/increased`` contrast. The value that you read depends entirely on user settings, and you can't change it. @Environment(\.colorSchemeContrast) private var colorSchemeContrast var body: some View { Text(colorSchemeContrast == .standard ? "Standard" : "Increased") } When adjusting your app's user interface to match the contrast, consider also checking the ``EnvironmentValues/colorScheme`` property to find out if SwiftUI is displaying the view with a light or dark appearance. For information, see <doc://com.apple.documentation/design/human-interface-guidelines/accessibility#Color-and-effects> in the Human Interface Guidelines. > Note: If you only need to provide different colors or images for different color scheme and contrast settings, do that in your app's Asset Catalog. See <doc://com.apple.documentation/documentation/Xcode/Asset-Management>.
get horizontalSizeClass(): (UserInterfaceSizeClass) | nullSwift declaration@backDeployed(before: macOS 14.0, tvOS 17.0, watchOS 10.0)
var horizontalSizeClass: UserInterfaceSizeClass? { get set }The horizontal size class of this environment. You receive a ``UserInterfaceSizeClass`` value when you read this environment value. The value tells you about the amount of horizontal space available to the view that reads it. You can read this size class like any other of the ``EnvironmentValues``, by creating a property with the ``Environment`` property wrapper: @Environment(\.horizontalSizeClass) private var horizontalSizeClass SwiftUI sets this 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 this size class. For example, a ``NavigationView`` presents a multicolumn view when the horizontal size class is ``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. In watchOS, the horizontal size class is always ``UserInterfaceSizeClass/compact``. In macOS, and tvOS, it's always ``UserInterfaceSizeClass/regular``. Writing to the horizontal size class in the environment before macOS 14.0, tvOS 17.0, and watchOS 10.0 is not supported.
set horizontalSizeClass(value: (UserInterfaceSizeClass) | null)Swift declaration@backDeployed(before: macOS 14.0, tvOS 17.0, watchOS 10.0)
var horizontalSizeClass: UserInterfaceSizeClass? { get set }The horizontal size class of this environment. You receive a ``UserInterfaceSizeClass`` value when you read this environment value. The value tells you about the amount of horizontal space available to the view that reads it. You can read this size class like any other of the ``EnvironmentValues``, by creating a property with the ``Environment`` property wrapper: @Environment(\.horizontalSizeClass) private var horizontalSizeClass SwiftUI sets this 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 this size class. For example, a ``NavigationView`` presents a multicolumn view when the horizontal size class is ``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. In watchOS, the horizontal size class is always ``UserInterfaceSizeClass/compact``. In macOS, and tvOS, it's always ``UserInterfaceSizeClass/regular``. Writing to the horizontal size class in the environment before macOS 14.0, tvOS 17.0, and watchOS 10.0 is not supported.
get symbolRenderingMode(): (SymbolRenderingMode) | nullSwift declarationvar symbolRenderingMode: SymbolRenderingMode? { get set }The current symbol rendering mode, or `nil` denoting that the mode is picked automatically using the current image and foreground style as parameters.
set symbolRenderingMode(value: (SymbolRenderingMode) | null)Swift declarationvar symbolRenderingMode: SymbolRenderingMode? { get set }The current symbol rendering mode, or `nil` denoting that the mode is picked automatically using the current image and foreground style as parameters.
get toolbarVerticalEdge(): (HorizontalEdge) | nullSwift declarationvar toolbarVerticalEdge: HorizontalEdge? { get }The horizontal edge where the system places the vertical bar. This value reflects the system's preferred edge for the vertical bar in the current context, regardless of whether a vertical bar is currently visible. Use it to position custom bars or other UI relative to the system's bar placement. This value is read-only; the system determines the edge based on locale and device. Returns `nil` on devices and in contexts where the system never places a vertical bar — for example hardware without a vertical bar, or a size class or orientation in which no vertical bar is used. struct ContentView: View { @Environment(\.toolbarVerticalEdge) var toolbarVerticalEdge var body: some View { FloatingToolPalette() .frame(maxWidth: .infinity, alignment: toolbarVerticalEdge == .trailing ? .trailing : .leading) } }
get accessibilityEnabled(): booleanSwift declarationvar accessibilityEnabled: Bool { get set }A Boolean value that indicates whether the user has enabled an assistive technology.
set accessibilityEnabled(value: boolean)Swift declarationvar accessibilityEnabled: Bool { get set }A Boolean value that indicates whether the user has enabled an assistive technology.
get backgroundProminence(): BackgroundProminenceSwift declarationvar backgroundProminence: BackgroundProminence { get set }The prominence of the background underneath views associated with this environment. Foreground elements above an increased prominence background are typically adjusted to have higher contrast against a potentially vivid color, such as taking on a higher opacity monochrome appearance according to the `colorScheme`. System styles like `primary`, `secondary`, etc will automatically resolve to an appropriate style in this context. The property can be read and used for custom styled elements. In the example below, a custom star rating element is in a list row alongside some text. When the row is selected and has an increased prominence appearance, the text and star rating will update their appearance, the star rating replacing its use of yellow with the standard `secondary` style. struct RecipeList: View { var recipes: [Recipe] @Binding var selectedRecipe: Recipe.ID? var body: some View { List(recipes, selection: $selectedRecipe) { RecipeListRow(recipe: $0) } } } struct RecipeListRow: View { var recipe: Recipe var body: some View { VStack(alignment: .leading) { HStack(alignment: .firstTextBaseline) { Text(recipe.name) Spacer() StarRating(rating: recipe.rating) } Text(recipe.description) .foregroundStyle(.secondary) .lineLimit(2, reservesSpace: true) } } } private struct StarRating: View { var rating: Int @Environment(\.backgroundProminence) private var backgroundProminence var body: some View { HStack(spacing: 1) { ForEach(0..<rating, id: \.self) { _ in Image(systemName: "star.fill") } } .foregroundStyle(backgroundProminence == .increased ? AnyShapeStyle(.secondary) : AnyShapeStyle(.yellow)) .imageScale(.small) } } Note that the use of `backgroundProminence` was used by a view that was nested in additional stack containers within the row. This ensured that the value correctly reflected the environment within the list row itself, as opposed to the environment of the list as a whole. One way to ensure correct resolution would be to prefer using this in a custom ShapeStyle instead, for example: private struct StarRating: View { var rating: Int var body: some View { HStack(spacing: 1) { ForEach(0..<rating, id: \.self) { _ in Image(systemName: "star.fill") } } .foregroundStyle(FillStyle()) .imageScale(.small) } } extension StarRating { struct FillStyle: ShapeStyle { func resolve(in env: EnvironmentValues) -> some ShapeStyle { switch env.backgroundProminence { case .increased: return AnyShapeStyle(.secondary) default: return AnyShapeStyle(.yellow) } } } } Views like `List` and `Table` as well as standard shape styles like `ShapeStyle.selection` will automatically update the background prominence of foreground views. For custom backgrounds, this environment property can be explicitly set on views above custom backgrounds.
set backgroundProminence(value: BackgroundProminence)Swift declarationvar backgroundProminence: BackgroundProminence { get set }The prominence of the background underneath views associated with this environment. Foreground elements above an increased prominence background are typically adjusted to have higher contrast against a potentially vivid color, such as taking on a higher opacity monochrome appearance according to the `colorScheme`. System styles like `primary`, `secondary`, etc will automatically resolve to an appropriate style in this context. The property can be read and used for custom styled elements. In the example below, a custom star rating element is in a list row alongside some text. When the row is selected and has an increased prominence appearance, the text and star rating will update their appearance, the star rating replacing its use of yellow with the standard `secondary` style. struct RecipeList: View { var recipes: [Recipe] @Binding var selectedRecipe: Recipe.ID? var body: some View { List(recipes, selection: $selectedRecipe) { RecipeListRow(recipe: $0) } } } struct RecipeListRow: View { var recipe: Recipe var body: some View { VStack(alignment: .leading) { HStack(alignment: .firstTextBaseline) { Text(recipe.name) Spacer() StarRating(rating: recipe.rating) } Text(recipe.description) .foregroundStyle(.secondary) .lineLimit(2, reservesSpace: true) } } } private struct StarRating: View { var rating: Int @Environment(\.backgroundProminence) private var backgroundProminence var body: some View { HStack(spacing: 1) { ForEach(0..<rating, id: \.self) { _ in Image(systemName: "star.fill") } } .foregroundStyle(backgroundProminence == .increased ? AnyShapeStyle(.secondary) : AnyShapeStyle(.yellow)) .imageScale(.small) } } Note that the use of `backgroundProminence` was used by a view that was nested in additional stack containers within the row. This ensured that the value correctly reflected the environment within the list row itself, as opposed to the environment of the list as a whole. One way to ensure correct resolution would be to prefer using this in a custom ShapeStyle instead, for example: private struct StarRating: View { var rating: Int var body: some View { HStack(spacing: 1) { ForEach(0..<rating, id: \.self) { _ in Image(systemName: "star.fill") } } .foregroundStyle(FillStyle()) .imageScale(.small) } } extension StarRating { struct FillStyle: ShapeStyle { func resolve(in env: EnvironmentValues) -> some ShapeStyle { switch env.backgroundProminence { case .increased: return AnyShapeStyle(.secondary) default: return AnyShapeStyle(.yellow) } } } } Views like `List` and `Table` as well as standard shape styles like `ShapeStyle.selection` will automatically update the background prominence of foreground views. For custom backgrounds, this environment property can be explicitly set on views above custom backgrounds.
get isHoverEffectEnabled(): booleanSwift declarationvar isHoverEffectEnabled: Bool { get set }A Boolean value that indicates whether the view associated with this environment allows hover effects to be displayed. The default value is `true`.
set isHoverEffectEnabled(value: boolean)Swift declarationvar isHoverEffectEnabled: Bool { get set }A Boolean value that indicates whether the view associated with this environment allows hover effects to be displayed. The default value is `true`.
get splitArrangementAxis(): (Axis) | nullSwift declarationvar splitArrangementAxis: Axis? { get set }The axis of the split for a view within a split arrangement view. Use this value to read the axis that a split arrangement is using to place its views. Views can adapt their layout or appearance based on whether the split is horizontal or vertical. The value is `nil` when the view is not contained within a split arrangement view. struct DetailsView: View { @Environment(\.splitArrangementAxis) var axis var body: some View { let layout: AnyLayout = axis == .horizontal ? AnyLayout(VStackLayout()) : AnyLayout(HStackLayout()) layout { Artwork() Metadata() } } }
set splitArrangementAxis(value: (Axis) | null)Swift declarationvar splitArrangementAxis: Axis? { get set }The axis of the split for a view within a split arrangement view. Use this value to read the axis that a split arrangement is using to place its views. Views can adapt their layout or appearance based on whether the split is horizontal or vertical. The value is `nil` when the view is not contained within a split arrangement view. struct DetailsView: View { @Environment(\.splitArrangementAxis) var axis var body: some View { let layout: AnyLayout = axis == .horizontal ? AnyLayout(VStackLayout()) : AnyLayout(HStackLayout()) layout { Artwork() Metadata() } } }
get fontResolutionContext(): Font_ContextSwift declarationvar fontResolutionContext: Font.Context { get }Information used to resolve a font. - SeeAlso: ``Font/resolve(in:)``
get multilineTextAlignment(): TextAlignmentSwift declarationvar multilineTextAlignment: TextAlignment { get set }An environment value that indicates how a text view aligns its lines when the content wraps or contains newlines. Set this value for a view hierarchy by applying the ``View/multilineTextAlignment(_:)`` view modifier. Views in the hierarchy that display text, like ``Text`` or ``TextEditor``, read the value from the environment and adjust their text alignment accordingly. This value has no effect on a ``Text`` view that contains only one line of text, because a text view has a width that exactly matches the width of its widest line. If you want to align an entire text view rather than its contents, set the aligment of its container, like a ``VStack`` or a frame that you create with the ``View/frame(minWidth:idealWidth:maxWidth:minHeight:idealHeight:maxHeight:alignment:)`` modifier. > Note: You can use this value to control the alignment of a ``Text`` view that you create with the ``Text/init(_:style:)`` initializer to display localized dates and times, including when the view uses only a single line, but only when that view appears in a widget.
set multilineTextAlignment(value: TextAlignment)Swift declarationvar multilineTextAlignment: TextAlignment { get set }An environment value that indicates how a text view aligns its lines when the content wraps or contains newlines. Set this value for a view hierarchy by applying the ``View/multilineTextAlignment(_:)`` view modifier. Views in the hierarchy that display text, like ``Text`` or ``TextEditor``, read the value from the environment and adjust their text alignment accordingly. This value has no effect on a ``Text`` view that contains only one line of text, because a text view has a width that exactly matches the width of its widest line. If you want to align an entire text view rather than its contents, set the aligment of its container, like a ``VStack`` or a frame that you create with the ``View/frame(minWidth:idealWidth:maxWidth:minHeight:idealHeight:maxHeight:alignment:)`` modifier. > Note: You can use this value to control the alignment of a ``Text`` view that you create with the ``Text/init(_:style:)`` initializer to display localized dates and times, including when the view uses only a single line, but only when that view appears in a widget.
get symbolVariableValueMode(): (SymbolVariableValueMode) | nullSwift declarationvar symbolVariableValueMode: SymbolVariableValueMode? { get set }The current symbol variable value mode, or `nil` denoting that the mode is picked automatically.
set symbolVariableValueMode(value: (SymbolVariableValueMode) | null)Swift declarationvar symbolVariableValueMode: SymbolVariableValueMode? { get set }The current symbol variable value mode, or `nil` denoting that the mode is picked automatically.
get accessibilityShowBorders(): booleanSwift declaration@backDeployed(before: iOS 26.1, macOS 26.1, tvOS 26.1, watchOS 26.1, visionOS 26.1)
var accessibilityShowBorders: Bool { get }Whether the system preference for Show Borders is enabled. On macOS 27 and later, the system provides a dedicated Show Borders setting in System Settings. On earlier versions of macOS, this value is true when Increased Contrast is enabled. When this value is true, draw interactive custom controls such as buttons with clearly visible edges so they remain distinguishable at any window size: struct BorderedButton: View { @Environment(\.accessibilityShowBorders) var showBorders var body: some View { Label("Archive", systemImage: "archivebox") .padding(8) .overlay { if showBorders { RoundedRectangle(cornerRadius: 8) .stroke(.secondary) } } } }
get materialActiveAppearance(): MaterialActiveAppearanceSwift declarationvar materialActiveAppearance: MaterialActiveAppearance { get set }The behavior materials should use for their active state, defaulting to `automatic`.
set materialActiveAppearance(value: MaterialActiveAppearance)Swift declarationvar materialActiveAppearance: MaterialActiveAppearance { get set }The behavior materials should use for their active state, defaulting to `automatic`.
get overlayArrangementZIndex(): numberSwift declarationvar overlayArrangementZIndex: Int { get set }The z-index for a view within an overlay arrangement view. Use this value to read the z-ordering of a view when it is placed in an overlay arrangement. Views with a higher z-index are rendered on top of views with a lower z-index. struct PlayerView: View { @Environment(\.overlayArrangementZIndex) var zIndex var body: some View { VideoPlayerControls() .opacity(zIndex == 0 ? 1.0 : 0.5) } }
set overlayArrangementZIndex(value: number)Swift declarationvar overlayArrangementZIndex: Int { get set }The z-index for a view within an overlay arrangement view. Use this value to read the z-ordering of a view when it is placed in an overlay arrangement. Views with a higher z-index are rendered on top of views with a lower z-index. struct PlayerView: View { @Environment(\.overlayArrangementZIndex) var zIndex var body: some View { VideoPlayerControls() .opacity(zIndex == 0 ? 1.0 : 0.5) } }
get symbolColorRenderingMode(): (SymbolColorRenderingMode) | nullSwift declarationvar symbolColorRenderingMode: SymbolColorRenderingMode? { get set }The property specifying how symbol images fill their layers, or nil to use the default fill style.
set symbolColorRenderingMode(value: (SymbolColorRenderingMode) | null)Swift declarationvar symbolColorRenderingMode: SymbolColorRenderingMode? { get set }The property specifying how symbol images fill their layers, or nil to use the default fill style.
get accessibilityInvertColors(): booleanSwift declarationvar accessibilityInvertColors: Bool { get }Whether the system preference for Invert Colors is enabled. If this property's value is true then the display will be inverted. In these cases it may be needed for UI drawing to be adjusted to in order to display optimally when inverted.
get accessibilityReduceMotion(): booleanSwift declarationvar accessibilityReduceMotion: Bool { get }Whether the system preference for Reduce Motion is enabled. If this property's value is true, UI should avoid large animations, especially those that simulate the third dimension.
get accessibilityShowButtonShapes(): booleanSwift declarationvar accessibilityShowButtonShapes: Bool { get }Whether the system preference for Show Button Shapes is enabled. If this property's value is true, interactive custom controls such as buttons should be drawn in such a way that their edges and borders are clearly visible.
get accessibilityVoiceOverEnabled(): booleanSwift declarationvar accessibilityVoiceOverEnabled: Bool { get }A Boolean value that indicates whether the VoiceOver screen reader is in use. The state changes as the user turns on or off the VoiceOver screen reader.
get accessibilityDimFlashingLights(): booleanSwift declarationvar accessibilityDimFlashingLights: Bool { get }Whether the setting to reduce flashing or strobing lights in video content is on. This setting can also be used to determine if UI in playback controls should be shown to indicate upcoming content that includes flashing or strobing lights.
get accessibilityPlayAnimatedImages(): booleanSwift declarationvar accessibilityPlayAnimatedImages: Bool { get }Whether the setting for playing animations in an animated image is on. When this value is false, any presented image that contains animation should not play automatically.
get accessibilityReduceTransparency(): booleanSwift declarationvar accessibilityReduceTransparency: Bool { get }Whether the system preference for Reduce Transparency is enabled. If this property's value is true, UI (mainly window) backgrounds should not be semi-transparent; they should be opaque.
get accessibilitySwitchControlEnabled(): booleanSwift declarationvar accessibilitySwitchControlEnabled: Bool { get }A Boolean value that indicates whether the Switch Control motor accessibility feature is in use. The state changes as the user turns on or off the Switch Control feature.
get contentTransitionAddsDrawingGroup(): booleanSwift declarationvar contentTransitionAddsDrawingGroup: Bool { get set }A Boolean value that controls whether views that render content transitions use GPU-accelerated rendering. Setting this value to `true` causes SwiftUI to wrap content transitions with a ``View/drawingGroup(opaque:colorMode:)`` modifier.
set contentTransitionAddsDrawingGroup(value: boolean)Swift declarationvar contentTransitionAddsDrawingGroup: Bool { get set }A Boolean value that controls whether views that render content transitions use GPU-accelerated rendering. Setting this value to `true` causes SwiftUI to wrap content transitions with a ``View/drawingGroup(opaque:colorMode:)`` modifier.
get accessibilityAssistiveAccessEnabled(): booleanSwift declarationvar accessibilityAssistiveAccessEnabled: Bool { get }A Boolean value that indicates whether Assistive Access is in use.
get accessibilityDifferentiateWithoutColor(): booleanSwift declarationvar accessibilityDifferentiateWithoutColor: Bool { get }Whether the system preference for Differentiate without Color is enabled. If this is true, UI should not convey information using color alone and instead should use shapes or glyphs to convey information.
get accessibilityLargeContentViewerEnabled(): booleanSwift declarationvar accessibilityLargeContentViewerEnabled: Bool { get }Whether the Large Content Viewer is enabled. The system can automatically provide a large content view with ``View/accessibilityShowsLargeContentViewer()`` or you can provide your own with ``View/accessibilityShowsLargeContentViewer(_:)``. While it is not necessary to check this value before adding a large content view, it may be helpful if you need to adjust the behavior of a gesture. For example, a button with a long press handler might increase its long press duration so the user can read the text in the large content viewer first.
get accessibilityReduceHighlightingEffects(): booleanSwift declarationvar accessibilityReduceHighlightingEffects: Bool { get }Whether the system preference for Reduce Bright Effects is enabled. If this property's value is true, controls, such as buttons, should be drawn in such a way that minimizes highlighting and flashing of onscreen elements.
get accessibilityPrefersCrossFadeTransitions(): booleanSwift declarationvar accessibilityPrefersCrossFadeTransitions: Bool { get set }A Boolean value that indicates whether the Reduce Motion and the Prefer Cross-Fade Transitions settings are in an enabled state. If this property's value is true, UI should avoid Slide animations and prefer Cross-Fade transitions instead On macOS, this value returns solely whether the Reduce Motion setting is in an enabled state. On watchOS, this value always returns false.
set accessibilityPrefersCrossFadeTransitions(value: boolean)Swift declarationvar accessibilityPrefersCrossFadeTransitions: Bool { get set }A Boolean value that indicates whether the Reduce Motion and the Prefer Cross-Fade Transitions settings are in an enabled state. If this property's value is true, UI should avoid Slide animations and prefer Cross-Fade transitions instead On macOS, this value returns solely whether the Reduce Motion setting is in an enabled state. On watchOS, this value always returns false.
get font(): (Font) | nullSwift declarationvar font: Font? { get set }The default font of this environment.
set font(value: (Font) | null)Swift declarationvar font: Font? { get set }The default font of this environment.
get locale(): _Foundation_LocaleSwift declarationvar locale: Locale { get set }The current locale that views should use.
set locale(value: _Foundation_Locale)Swift declarationvar locale: Locale { get set }The current locale that views should use.
get openURL(): Promise<OpenURLAction>Swift declaration@MainActor @preconcurrency var openURL: OpenURLAction { get set }An action that opens a URL. Read this environment value to get an ``OpenURLAction`` instance for a given ``Environment``. Call the instance to open a URL. You call the instance directly because it defines a ``OpenURLAction/callAsFunction(_:)`` method that Swift calls when you call the instance. For example, you can open a web site when the user taps a button: struct OpenURLExample: View { @Environment(\.openURL) private var openURL var body: some View { Button { if let url = URL(string: "https://www.example.com") { openURL(url) } } label: { Label("Get Help", systemImage: "person.fill.questionmark") } } } If you want to know whether the action succeeds, add a completion handler that takes a Boolean value. In this case, Swift implicitly calls the ``OpenURLAction/callAsFunction(_:completion:)`` method instead. That method calls your completion handler after it determines whether it can open the URL, but possibly before it finishes opening the URL. You can add a handler to the example above so that it prints the outcome to the console: openURL(url) { accepted in print(accepted ? "Success" : "Failure") } The system provides a default open URL action with behavior that depends on the contents of the URL. For example, the default action opens a Universal Link in the associated app if possible, or in the user’s default web browser if not. You can also set a custom action using the ``View/environment(_:_:)`` view modifier. Any views that read the action from the environment, including the built-in ``Link`` view and ``Text`` views with markdown links, or links in attributed strings, use your action. Initialize an action by calling the ``OpenURLAction/init(handler:)`` initializer with a handler that takes a URL and returns an ``OpenURLAction/Result``: Text("Visit [Example Company](https://www.example.com) for details.") .environment(\.openURL, OpenURLAction { url in handleURL(url) // Define this method to take appropriate action. return .handled }) SwiftUI translates the value that your custom action's handler returns into an appropriate Boolean result for the action call. For example, a view that uses the action declared above receives `true` when calling the action, because the handler always returns ``OpenURLAction/Result/handled``.
setOpenURL(value: OpenURLAction): Promise<void>Swift declaration@MainActor @preconcurrency var openURL: OpenURLAction { get set }An action that opens a URL. Read this environment value to get an ``OpenURLAction`` instance for a given ``Environment``. Call the instance to open a URL. You call the instance directly because it defines a ``OpenURLAction/callAsFunction(_:)`` method that Swift calls when you call the instance. For example, you can open a web site when the user taps a button: struct OpenURLExample: View { @Environment(\.openURL) private var openURL var body: some View { Button { if let url = URL(string: "https://www.example.com") { openURL(url) } } label: { Label("Get Help", systemImage: "person.fill.questionmark") } } } If you want to know whether the action succeeds, add a completion handler that takes a Boolean value. In this case, Swift implicitly calls the ``OpenURLAction/callAsFunction(_:completion:)`` method instead. That method calls your completion handler after it determines whether it can open the URL, but possibly before it finishes opening the URL. You can add a handler to the example above so that it prints the outcome to the console: openURL(url) { accepted in print(accepted ? "Success" : "Failure") } The system provides a default open URL action with behavior that depends on the contents of the URL. For example, the default action opens a Universal Link in the associated app if possible, or in the user’s default web browser if not. You can also set a custom action using the ``View/environment(_:_:)`` view modifier. Any views that read the action from the environment, including the built-in ``Link`` view and ``Text`` views with markdown links, or links in attributed strings, use your action. Initialize an action by calling the ``OpenURLAction/init(handler:)`` initializer with a handler that takes a URL and returns an ``OpenURLAction/Result``: Text("Visit [Example Company](https://www.example.com) for details.") .environment(\.openURL, OpenURLAction { url in handleURL(url) // Define this method to take appropriate action. return .handled }) SwiftUI translates the value that your custom action's handler returns into an appropriate Boolean result for the action call. For example, a view that uses the action declared above receives `true` when calling the action, because the handler always returns ``OpenURLAction/Result/handled``.
get calendar(): _Foundation_CalendarSwift declarationvar calendar: Calendar { get set }The current calendar that views should use when handling dates.
set calendar(value: _Foundation_Calendar)Swift declarationvar calendar: Calendar { get set }The current calendar that views should use when handling dates.
get textCase(): (Text_Case) | nullSwift declarationvar textCase: Text.Case? { get set }A stylistic override to transform the case of `Text` when displayed, using the environment's locale. The default value is `nil`, displaying the `Text` without any case changes.
set textCase(value: (Text_Case) | null)Swift declarationvar textCase: Text.Case? { get set }A stylistic override to transform the case of `Text` when displayed, using the environment's locale. The default value is `nil`, displaying the `Text` without any case changes.
get timeZone(): _Foundation_TimeZoneSwift declarationvar timeZone: TimeZone { get set }The current time zone that views should use when handling dates.
set timeZone(value: _Foundation_TimeZone)Swift declarationvar timeZone: TimeZone { get set }The current time zone that views should use when handling dates.
get isEnabled(): booleanSwift declarationvar isEnabled: Bool { get set }A Boolean value that indicates whether the view associated with this environment allows user interaction. The default value is `true`.
set isEnabled(value: boolean)Swift declarationvar isEnabled: Bool { get set }A Boolean value that indicates whether the view associated with this environment allows user interaction. The default value is `true`.
get lineLimit(): (number) | nullSwift declarationvar lineLimit: Int? { get set }The maximum number of lines that text can occupy in a view. The maximum number of lines is `1` if the value is less than `1`. If the value is `nil`, the text uses as many lines as required. The default is `nil`.
set lineLimit(value: (number) | null)Swift declarationvar lineLimit: Int? { get set }The maximum number of lines that text can occupy in a view. The maximum number of lines is `1` if the value is less than `1`. If the value is `nil`, the text uses as many lines as required. The default is `nil`.
static init(): EnvironmentValuesSwift declarationinit()Creates an environment values instance. You don't typically create an instance of ``EnvironmentValues`` directly. Doing so would provide access only to default values that don't update based on system settings or device characteristics. Instead, you rely on an environment values' instance that SwiftUI manages for you when you use the ``Environment`` property wrapper and the ``View/environment(_:_:)`` view modifier.
2 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
EnvironmentValues.subscript(_:)
Passing a Swift type itself is not supported.
EnvironmentValues.subscript(_:)
Passing a Swift type itself is not supported.