Member-only story
TableView (List) in SwiftUI
Project Link : https://github.com/EdyLucky/TableView-List-SwiftUI
List keyword has been used to create TableView in SwiftUI. We just need to add below code to create simple static tableview.
import SwiftUI
struct ContentView : View {
var body: some View {
List {
Text(“First Row”)
Text(“Second Row”)
Text(“Second Row”)
}
}
}
To make dynamic List (TableView), we will create custom Array and import images to our project which have same name as array items. (Images can be downloaded from the link to github account above)
First we will create titles array and use array inside list as shown below.
import SwiftUI
struct ContentView : View {
var titles = [“Swift”, “SwiftUI”, “Xcode”, “iOS”, “Mac”]