From the course: SwiftUI Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

List interaction

List interaction

- [Instructor] We have a lot of lists going on here. If your list is a dynamic one, like the order list you can manipulate it with some modifiers. Let's look at two common ones, deletion and moving. Since we only have one really dynamic list and that's OrderView, we're going to head over there next. Okay and we can close up the preview for now. And let's go down towards the bottom of the code here and you'll see where we got our ForEach here. Okay, so you're going to use a ForEach. Right here we have a list. Lists on their own will not take the modifiers and only ForEach. So what you're going to have to do is change this around a little bit in terms of the code. And we're still going to want a list here. So there is a way of getting both. And that is that you're going to put the ForEach within the list. So I can just do List and then put a bracket and then put ForEach, delete that other bracket. And then I just…

Contents