๐Ÿ”ธenvironment value

SwiftUI โŸฉ view โŸฉ environment โŸฉ value

A defined collection of values related to a view.

  • Some of these automatically reflect system state, user settings, or view state. Examples include the color scheme, text style, or focus state of the view.

  • Others provide useful default values, such as a line limit for text fields.

// read the color scheme (an environment value) of the current view
@Environment(\.colorScheme) var colorScheme: ColorScheme
  • dismiss๏ผšAn action that dismisses the current presentation.

Last updated