From the course: iOS Development Tips

Unlock this course with a free trial

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

Key paths

Key paths

- [Narrator] You might have noticed, especially in Swift UI lists for each and environment variables, the slash dot identifiers, you'll see one here in my playground file for for each. They are known as key pass. And let's explore a little of what you can do with them. Key paths are references to properties, you can change properties you are using dynamically during runtime. Now you can see down here I have basic examples. I'm going to give you an example of one of these. And we can just do a VAR here. And we're going to call this name KP. And then will be of type key path. And type key path has two other objects it needs the first one it needs is the object is going to be working on in this case, we're going to be using menu item. And it's going to need the type of properties is going to be working with which in this case is going to be a string. And I'm going to use name here So I can do this as menu item, dot name.…

Contents