Member-only story

TableView (List) in SwiftUI

Elshad Karimov
2 min readJul 3, 2019

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”]

--

--

Elshad Karimov
Elshad Karimov

Written by Elshad Karimov

Software Engineer, Udemy Instructor and Book Author, Founder at AppMillers

No responses yet