create a table in swiftui in swift

To create a table in SwiftUI, you can use the List view. Here's an example:

main.swift
struct ContentView: View {
    var items = ["Item 1", "Item 2", "Item 3"]
    
    var body: some View {
        List(items, id: \.self) { item in
            Text(item)
        }
    }
}
188 chars
10 lines

In this example, we're creating a List view with an array of items. We're using the id parameter to specify a unique identifier for each item in the list. We're then using the Text view to display the item in the list.

You can also customize the list view by adding additional views or modifiers. For example, you can add a NavigationLink to create a detail view for each item, or use modifiers to change the font or color of the text.

gistlibby LogSnag