List in SwiftUI

To create a list in SwiftUI, you can use the List view. Here is an example of how you could create a list of names using the List view:

import SwiftUI 

struct ContentView: View { 

  let names = ["Saif", "Justin", "Sarah", "Ahmed"] 

  var body: some View { 
    List(names, id: \.self) { name in 

In this example, the List view is initialized with the names array and a closure that specifies what each item in the list should look like. In this case, the closure creates a Text view for each name in the array, which will display the name as a piece of text in the list.

When you run this code, you will see a list of names on the screen. You can interact with the list just like you would with any other list, such as scrolling up and down and selecting items.

Here is an example of what the list might look like when rendered:

Keep in mind that this is just a simple example, and you can customize the List view in many different ways to make it look and behave exactly how you want. For more information, see the SwiftUI documentation.