Jagan Mohan Sahu
Jagan Mohan Sahu

Reputation: 33

List view in SwiftUI takes up entire screen height

In SwiftUI, list view by default takes up entire height of the screen and pushes other elements/views to the bottom of the screen. But I want to append some elements/views where the list items exactly end.

List view having 10 items

Upvotes: 1

Views: 2855

Answers (1)

Subha_26
Subha_26

Reputation: 450

You can add spacer() at appropriate places in the VStack or try something like below:


VStack {
            CustomView1()
            List {
                Section(header: HeaderView(), footer: FooterView())
                {
                    ForEach(viewModel.permissions) { permission in
                        CustomeView2()
                }
                    GeneralView()//add the views at the end of list items
                }
            }.listStyle(GroupedListStyle())
            
        }

Upvotes: 2

Related Questions