From the course: Complete Guide to SwiftUI

Unlock this course with a free trial

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

System environment variables

System environment variables

- [Instructor] Swift UI has a variation on environment variables called environment values. 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 environment values. Let's look at how to use them and show you three you may find very useful. Now we're already in content view, 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 seat 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 to the head of view, which is right up here, and just add that right in here. It'll be environment and then you put a key in here and that one's going to…

Contents