From the course: SwiftUI Essential Training

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

System environment variables

System environment variables

- [Instructor] SwiftUI has a variation on environment variables called EnvironmentValues. These are system values you can read or set not found in modifiers. You can find a list of them in the Apple Developer Documentation for EnvironmentValues. Let's look at how to use them and show you three you may find very useful. Now, we're already in ContentView, so if you go ahead and over here to change it and see what it would look like in a color scheme of dark appearance, notice that the Huli Pizza Company logo is too dark to see on the sea over here. So we want to keep this white all the time, or a light color. So what I'm going to do is go back over here, I'm going to turn it off for now. And I can use a special modifier to get the environment for this to say, "Okay, this is only going to be in light mode," okay? So we can go over here, the HeaderView, which is right up here, and just add that right in here. It'll be…

Contents