Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove empty rows in List Swift UI Xcode 11

How to remove empty rows in List by using Swift UI Here is my code.

struct LandMarkList: View {
    var body: some View {
        NavigationView {
            List(LandMarkListData) { landmark in
                LandMarkRow(landmark: landmark)
            }

        .navigationBarTitle("List")
        }
    }
}
like image 740
Shahbaz Akram Avatar asked Oct 08 '19 10:10

Shahbaz Akram


1 Answers

struct LandMarkList: View {
    var body: some View {
        NavigationView {
            List(LandMarkListData) { landmark in
                LandMarkRow(landmark: landmark)
            }

            .navigationBarTitle("List")
            .listStyle(GroupedListStyle())
        }
    }
}

Finally i have found the solution by adding the listStyle.

like image 121
Shahbaz Akram Avatar answered Oct 11 '22 02:10

Shahbaz Akram